Posts Tagged ‘pointer’

Function pointers

A useful techniques is the ability to have pointer to functions. Their declaration is easy: write the declaration as it would be for the function, example:

int my_func(int var_a, int var_b);

and the following form make a pointer which pointed to my_func:

int (*my_func_p)(int, int);

Once you have got the pointer, you can assign the address of the function you declared by using just its name:

like an array, a function name is returned into an address when it is used in an expression. You can call the function using one of two form:

  1. (more…)

Read Full Post »