Functions also have addresses, for which there are pointer-to-function types expressing the parameters and return type. The pointers can be passed to or returned from other functions just as other data can.
void goodswap(int *, int *); void (*swapfunc)(int *, int *); /* a pointer calledswapfunc
*/ int x, y; swapfunc = &goodswap; /* Now it points to a function */ /* with matching parameters. */ (*swapfunc)(&x, &y); /* Invokesgoodswap(&x, &y)
. */
Since pointers to functions are just values like any other, they can be passed to and returned from functions, so that ‘behaviour’ itself becomes just another form of data.