Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


for(i=1;i>0;i++);
printf("i=%d",i);
what will be the answer????

Answers were Sorted based on User's Feedback



for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????..

Answer / rajesh jat

i is a signed integer
it will print only and only -32768
//KEEP IT DIRTY

Is This Answer Correct ?    16 Yes 3 No

for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????..

Answer / vignesh1988i

since after the loop there is a semicolon , so according to
the compiler this semicolon will be taken as next line and
the loop will be iterating till the termination condition....


output possibilities :

1)if the variable 'i' which is used as an signed integer
variable , this will take an infinite values and stop at one
instance and it will terminate the application. but wont
display anything in the screen

2) if this is an unsigned variable this will be infinite
with values going on and on without stopping.. but not
displaying it...


conclusion : loop is infinite here.....



thank u

Is This Answer Correct ?    12 Yes 8 No

for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????..

Answer / ankit shekhavat

after for lop,there is a semicolon.it means loop terminate
here..condition inside the loop will always true.so it will
be an infinite loop..nothing will be printed on the screen.
for next statement there will be printed any garbage value...

Is This Answer Correct ?    7 Yes 6 No

for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????..

Answer / guest

The value of i starts at 1 and increments from there. The
loop terminates when i <= 0.

For an unsigned value, this is only possible when i == 0.

For a signed value, incrementing a positive value by 1 will
eventually overflow within the binary word to become the
most negative value an integer can hold. The sequence is
thus (..., INT_MAX-1, INT_MAX, INT_MIN) and the loop
terminates, where INT_MAX and INT_MIN are the "most
positive" and "most negative" values for the word size used
on your machine.

Is This Answer Correct ?    1 Yes 1 No

for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????..

Answer / guest

i=1i=1etc.

Is This Answer Correct ?    1 Yes 7 No

for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????..

Answer / naren

ans is i=2

Is This Answer Correct ?    1 Yes 13 No

for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????..

Answer / guest

4

Is This Answer Correct ?    0 Yes 18 No

Post New Answer



More C Interview Questions

main() { int i=0; while(+(+i--)!=0) i-=i++; printf(i); }

3 Answers  


What is a file descriptor in c?

0 Answers  


Write a programm such that if user enter 11.25 it roundup to 11 but if user enter 11.51 upto 11.99 it will round up to 12 i.e.;convert the floting point value into integer format as explain above..

2 Answers  


What is the difference between GETS();AND SCANF();

4 Answers   TCS,


When do we get logical errors?

0 Answers  






Explain how can I avoid the abort, retry, fail messages?

0 Answers  


C passes By value or By reference?

5 Answers   Geometric Software, Infosys,


#define d 10+10 main() { printf("%d",d*d); }

6 Answers  


Explain what will the preprocessor do for a program?

0 Answers  


In a header file whether functions are declared or defined?

0 Answers   TISL,


 Illustrate it   summing the series 2+4+6+......to n terms using  (i) while loop (ii) do-while loop

2 Answers  


write a program in c to read array check element is present or not?

1 Answers  






Categories