In this program the compiler will not know that the function display() exists. So, the compiler will generate "Type mismatch in redeclaration of function display()".
To over come this error, we have to add function prototype of function display(). Another way to overcome this error is to define the function display() before the int main(); function.
#include<stdio.h>int main()
{
int (*p)() = fun;
(*p)();
return 0;
}
int fun()
{
printf("Pak-mcqs.net\n");
return 0;
}
A.
Error: in int(*p)() = fun;
B.
Error: fun() prototype not defined
C.
No error
D.
None of above
Answer: Option B
Explanation:
The compiler will not know that the function int fun() exists. So we have to define the function prototype of int fun(); To overcome this error, see the below program
#include<stdio.h>int fun();
int main()
{
int (*p)() = fun;
(*p)();
return 0;
}
int fun()
{
printf("Pak-mcqs.net\n");
return 0;
}