for(i=1;i>0;i++);
printf("i=%d",i);
what will be the answer????
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
What is the output of the program #include<stdio.h> #include<conio.h> void main() {0 int i,j=20; clrscr(); for(i=1;i<3;i++) { printf("%d,",i); continue; printf("%d",j); break; } getch(); }
The differences between Windows XP and Windows Visa
What is data type long in c?
What is the c language function prototype?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
How can I swap two values without using a temporary?
#include<stdio.h> int main( ) { Int a=300, b, c; if(a>=400) b=300; c=200; printf(“%d%d ”, b, c); return0; }
write a c/c++ program that takes a 5 digit number and calculates 2 power that number and prints it?
What is an lvalue and an rvalue?
Is it possible to pass an entire structure to functions?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning