#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
praagnovation
Why is c called a mid-level programming language?
What is a stream in c programming?
Write a program to identify if a given binary tree is balanced or not.
What is actual argument?
Explain setjmp()?
What is the difference between null pointer and wild pointer?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What is the difference between a function and a method in c?
I came across some code that puts a (void) cast before each call to printf. Why?
What is the difference between %d and %i?
Write a program to check armstrong number in c?
What are preprocessor directives in c?
What is a pointer and how it is initialized?
When is a “switch” statement preferable over an “if” statement?