C - Functions - Discussion

You Are Here :: Home > C > Functions - Discussion

 



Q.

#include

int i;
int fun();
int main()
{
while(i)
{
fun();
main();
}
printf("Hello\n");
return 0;
}
int fun()
{
printf("Hi");
}

A. Hello B. Hi Hello
C. No output D. Infinite loop

Answer: Option A
Explaination:

int fun(); This prototype tells the compiler that the function fun() does not accept any arguments and it returns an integer value. while(i) The value of i is not initialized so this while condition is failed. So, it does not execute the while block. It prints "Hello".



Discussion

Your Comments Goes here...
NameDiscussion