I have a simple question:
What is the type of function in C or C++
As we can have pointers to function in C or C++, that means functions should have a specific type otherwise type checking during pointers to function creation have no meaning.
Can someone explain me, I am on the correct path or not?
If I am on the right path, How can I find the type of function?
Syntax for function pointers
The type of a function in C/C++ includes both the
return typeand thetypes of input parameters.Consider the following function declaration:
A pointer to that function has the following type:
Similarly in general :
A corresponding pointer to such a function is
There are be many different types of functions. Find a useful reference on function pointers here.
Also, this classification is based on the
return type and argument types. Functions can also be classified on the basis of scope of their accessibility. like global functions, static functions etc. See here for a short introduction.