Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

What is a scope resolution operator in c?

0 Answers  


how can we print  hellow world programme without using semicolon

3 Answers  


Why & is used in c?

0 Answers  


"I LOVE MY COUNTRY" write a c program to get "COUNTRY MY LOVE I" as the output. Use any other programming language. It is not mandatory to use C.

11 Answers   ABC Infotech, ADP, College School Exams Tests, Kovair,


Write a program to print factorial of given number using recursion?

0 Answers  


how many header file is in C language ?

44 Answers   College School Exams Tests, CTS, IBM, IMS, Infosys, ME, Sign Solutions, Wipro, XVT,


#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9; int z=(c=x+y)*2; printf("%h %h %h",x,y,z); } What is the output? Explain it.

8 Answers   IBM,


What is output redirection?

0 Answers  


Can stdout be forced to print somewhere other than the screen?

0 Answers  


int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15

10 Answers   Wipro,


what is the importance of spanning tree?

0 Answers  


study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above

15 Answers   Accenture, TCS,


Categories