C Programming - Functions - Discussion
Discussion Forum : Functions - Find Output of Program (Q.No. 18)
18.
What will be the output of the program?
#include<stdio.h>
int fun(int(*)());
int main()
{
fun(main);
printf("Hi\n");
return 0;
}
int fun(int (*p)())
{
printf("Hello ");
return 0;
}
Discussion:
33 comments Page 4 of 4.
Kunal said:
1 decade ago
Yes it is a function pointer....fun(main) sends a copy of main() function to p and it becomes the argument of fun().it prints hello then return the control to the calling fuction ...then rest of the part is executed.
Vinod said:
1 decade ago
I think it is a function pointer.
Jitu said:
1 decade ago
How? please explain with logic.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers