The compilation will be started from the main method. We know that function is not simple as variable, so function pointers have parameter list and return type as function. A function pointer is initialized as follows: We can breakdown the above syntax into the following components: Once initialized, you can make funcPtr point to a function like this: foo is the name of the function which is being pointed to. Before using a function pointer, you need to assign it an address of a function. /*Initialize function pointer(which stores the address of myFunc function)*/ Writing funcPtr = foo; is a valid syntax as well. Hope you got it easy to implement and learn using this tutorial. // initialize funPtr pointer Open the main.c file again to update it. { cout << "Your Name is :" <
function pointer example