#include<stdio.h>
int fun();
int i;
int main()
{
while(i)
{
fun();
main();
}
printf("hello \n");
return 0;
}
int fun()
{
printf("hi");
}
answer is hello.how??wat is tat while(i) mean?
Answer Posted / vignesh1988i
see first of all variable 'i' is declared as a global
storage class variable .. so according to that storage class
whenever we define an variable i before the main function
and explicatily we haven't initilized that variable means it
will defaultly variable i will have 0....
so when this while is compiled i has 0 which makes the loop
false.. so it will compile the very first statement after
that loop... so it prints hello...........
thank u
| Is This Answer Correct ? | 18 Yes | 0 No |
Post New Answer View All Answers
Is c dynamically typed?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
How can a program be made to print the name of a source file where an error occurs?
What is || operator and how does it function in a program?
What is enumerated data type in c?
Can a variable be both constant and volatile?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is anagram in c?
Why c is a procedural language?
What does s c mean in text?
Why is sprintf unsafe?
In which layer of the network datastructure format change is done
Explain the difference between getch() and getche() in c?
What is omp_num_threads?