ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
for(i=1;i>0;i++);
printf("i=%d",i);
what will be the answer????
 Question Submitted By :: Minakshi
I also faced this Question!!     Rank Answer Posted By  
 
  Re: for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????
Answer
# 1
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 ?    7 Yes 2 No
Vignesh1988i
 
  Re: for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????
Answer
# 2
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 ?    1 Yes 2 No
Ankit Shekhavat
 
 
 
  Re: for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????
Answer
# 3
i is a signed integer
it will print  only and only -32768
//KEEP IT DIRTY
 
Is This Answer Correct ?    8 Yes 0 No
Rajesh Jat
 
  Re: for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????
Answer
# 4
4
 
Is This Answer Correct ?    0 Yes 6 No
Guest
 
  Re: for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????
Answer
# 5
ans is i=2
 
Is This Answer Correct ?    0 Yes 3 No
Naren
 
  Re: for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????
Answer
# 6
i=1i=1etc.
 
Is This Answer Correct ?    0 Yes 1 No
Guest
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
can i know the source code for reversing a linked list with out using a temporary variable? Honeywell6
write an algorithm which can find the largest number among the given list using binary search ............... this was asked in the interview Satyam2
main() { int arr[5]={23,67}; printf("%d%d%d",arr[2],arr[3],arr[4]); } TCS6
1)which of following operator can't be overloaded. a)== b)++ c)?! d)<= Siemens10
Can you think of a way when a program crashed before reaching main? If yes how?  2
which types of data structure will i use to convert infix to post fix??? IIT3
What is the difference between char a[] = "string"; and char *p = "string"; ? Honeywell11
C passes By value or By reference? Geometric-Software5
How to access or modify the const variable in c ? HP4
Can u return two values using return keyword? If yes, how? If no, why?  7
What is function pointer and where we will use it NetApp1
What is volatile  2
what is the difference between getch() and getchar()?  5
how to find string length wihtout using c function?  4
what is the different between if-else and switch statment (other than syntax) CTS9
Is the following code legal? struct a { int x; struct a b; }  3
Determine if a number is a power of 2 at O(1).  1
Difference Between embedded software and soft ware? Bosch1
code snippet for creating a pyramids triangle ex 1 2 2 3 3 3  3
Give me basis knowledge of c , c++...  4
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com