In the second case, the type of function is configured to become a pointer to a function, which makes both functions identical.
int fun(int (*g)()); int fun(int g());
The C ++ 03 standard states in ยง13.1 / 3,
Declarations of parameters that differ only in this are a type of function, and the other is a pointer to the same type of function equivalent . That is, the type of function is configured to become a pointer to the type of function (8.3.5) .
[Example: void h(int()); void h(int (*)());
The same as setting the array to a pointer, with which we are more familiar:
int fun(int *a); int fun(int a[]);
All are the same!
Here you can answer a few questions:
Nawaz source share