分类: C/C++
2009-08-14 09:40:55
(*pointer_to_function)();
pointer_to_function();
(*pointer_to_function)();
pointer_to_function();
/*
* Compile options needed: none
*/
#include
void main(void)
{
void ftn(void);
void (*ptr_to_ftn)(void);
ptr_to_ftn = ftn; // The pointer is correctly assigned
// the address of 'ftn()'
printf("\nCalling the function\n\n");
ptr_to_ftn(); // This is not traditional syntax for
// a call through a function pointer
printf("back to main\n");
}
void ftn(void)
{
printf("in the function\n\n");
}