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 3 of 4.
Manu said:
1 decade ago
But what is the use of passing the copy of main() to the function?
Govind said:
9 years ago
Please, can anyone explain fun(main) will not go for infinite?
Aritra said:
9 years ago
@Govind.
Your explanations are really helpful. Thanks a lot.
Your explanations are really helpful. Thanks a lot.
XYZ said:
1 decade ago
Can we write like these :fun(main) ?
Is it valid? How?
Is it valid? How?
Karthik said:
8 years ago
Why the infinite loop not exist when main was used?
Niharika said:
9 years ago
As main call go there will recursion and no output.
Suraj said:
6 years ago
Thanks for the valuable information @Govind.
Riyaz said:
1 decade ago
Can anyone provide explanation to this?
Asha said:
1 decade ago
What is the meaning of fun(main) ?
Vinod said:
1 decade ago
I think it is a function pointer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers