Thanks for the reply... but I am still not clear since I am very bad at understanding the function pointers at first stage and then the question itself isn't very clear to me...
Could someone please help me here so that I can solve the question or help me in solving the question.
Basically, the (IMO) clearest way to define function ptrs is with a typedef. The syntax looks like this, as hamsterman showed in his post: typedef RETURN_TYPE (*TYPEDEF_NAME)(PARAMETER_LIST);
Now to call a function pointer, you simply dereference the name of the pointer and call it like a function.
1 2
TYPEDEF_NAME func_ptr;
(*func_ptr)();
Consider this simple situation, where you have a function that takes no parameters:
1 2 3 4 5
int func(); // function
typedefint (*ptr_type)(); // function pointer type
ptr_type ptr = &func; // create a pointer and point it to the original function
func(); // This is the same as
(*ptr)(); // this.
No, a function pointer is a pointer, so ptr() or ptr = func is technically not valid. (Although some compilers support it anyway, since it is "obvious" I guess)