#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


Please Help Members By Posting Answers For Below Questions

Is linux written in c?

605


What is ## preprocessor operator in c?

620


What is #include stdio h and #include conio h?

605


Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

1731


Is c weakly typed?

583






Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.

1601


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

730


What is a substring in c?

594


How do you initialize pointer variables?

618


Is printf a keyword?

764


Is it possible to pass an entire structure to functions?

563


hi send me sample aptitude papers of cts?

1661


Explain what are preprocessor directives?

634


What is a null pointer in c?

603


When should volatile modifier be used?

560