/* fptrs-01.c */ #include #include #include void myPrint(); void yourPrint(); int main( int argc, char *argv[] ) { void (*print)(); /* THIS IS A VARIABLE. Its type is: pointer to void function that takes no args */ print = myPrint; /* funct ptr var's name is print. It gets the address of myPrint. no ( ) s */ print(); print = yourPrint; /* funct ptr var's name is print. It gets the address of yourPrint. no ( ) s */ print(); return 0; } void myPrint() { int i=0; printf("\nmyPrint: "); for ( ; i<5 ; ++i) printf("%d ",i); printf("\n"); } void yourPrint() { int i=0; char *words[] = { "able", "baker", "charlie", "delta", "echo" }; printf("\nyourPrint: "); for ( ; i<5 ; ++i) printf("%s ",words[i]); printf("\n"); }