Why cast “extern puts” to a function pointer “(void(*)(char*))&puts”?
问题 I'm looking at example abo3.c from Insecure Programming and I'm not grokking the casting in the example below. Could someone enlighten me? int main(int argv,char **argc) { extern system,puts; void (*fn)(char*)=(void(*)(char*))&system; char buf[256]; fn=(void(*)(char*))&puts; strcpy(buf,argc[1]); fn(argc[2]); exit(1); } So - what's with the casting for system and puts? They both return an int so why cast it to void? I'd really appreciate an explanation of the whole program to put it in