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.

Ram said:   7 years ago
Is this the correct way of passing any function into another function? Please explain.

Giridhar said:   6 years ago
Pointer function "*p() " which is referring to main is not invoking in "fun(int (*p) ()) ". So, the main() function is not invoked in recursive.

Suraj said:   6 years ago
Thanks for the valuable information @Govind.


Post your comments here:

Your comments will be displayed after verification.