Tuesday 26 September 2023

Pointer to Function Concept in detail with example


 Pointer to Function:

Like built in variables function also contains address.

How to declare function pointer?
return type (*fp)( );  // in this way you have to declare function pointer to hold the address of function.
void add( );


void (*fp) ( );  // declaration of function pointer to hold the address of function add();


fp=add;


so you can call add() function like (*fp)( );







data structures and algorithms Web Developer