Question
#include<stdio.h>
int main()
{
int (*p)() = fun;
(*p)();
return 0;
}
int fun()
{
printf("Placementadda");
return 0;
}
Point out the error in the following program.
#include<stdio.h>
int main()
{
int (*p)() = fun;
(*p)();
return 0;
}
int fun()
{
printf("Placementadda");
return 0;
}
Answer: Option B
#include<stdio.h>
int fun(); /* function prototype */
int main()
{
int (*p)() = fun;
(*p)();
return 0;
}
int fun()
{
printf("placementadda");
return 0;
}
Was this answer helpful ?
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(); /* function prototype */
int main()
{
int (*p)() = fun;
(*p)();
return 0;
}
int fun()
{
printf("placementadda");
return 0;
}
Was this answer helpful ?
More Questions on This Topic :
Question 3.
By default a real number is treated as a
....
Question 4.
What is the output of the program
#includ....
Question 9.
Which of the following statements should be ....
Submit Solution