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;
}
Infinite loop
Hi
Hello Hi
Error
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
33 comments Page 4 of 4.

Vinod said:   1 decade ago
I think it is a function pointer.

Jitu said:   1 decade ago
How? please explain with logic.

Bagesh Kumar bagi said:   1 decade ago
First fun(main) come in the function and print the HELLO after that it will be return and it print the Hi

So that the finaly output is

hello hi..


Post your comments here:

Your comments will be displayed after verification.