Sunday, October 07, 2007

typedef a function header: useful to define function pointers

* explains how to do typedef to a function pointer.
*/
#include <stdio.h>

typedef int (*FUNC)(char* z, int a);

int func(char* z, int a){
printf("my func. \n");
// do something

return 0;
}

int main(){

FUNC pFunc = func;
char test[100];
pFunc(test, 6);

return 0;