Actions

EmSys

C - Pointers to Functions

From EdWiki

Pointers to Functions

In C, a function itself is not a variable, but it is possible to define “pointers to functions”, which can be assigned, placed in arrays, passed to functions, returned by functions and so on.

int (*draw)(int, int);

Which says that draw is a pointer to a function that has two integer arguments and returns an int.

int LineDraw(int, int);
draw = LineDraw;
(*draw)(i, j);  // call the function through function pointer
int LineDraw(int x, int y)  	{  }