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   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
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
What is the output of the program given below 

#include<stdio.h>
     main()
    {
       char i=0;
       for(;i>=0;i++) ;
       printf("%d\n",i);
    }
 Question Submitted By :: Rajesh
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 1
-128
 
Is This Answer Correct ?    1 Yes 0 No
Sh College,thevara
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 2
The loop never gets terminated as it runs infinite. So the 
printf statement will not trigger & no o/p is produced.
 
Is This Answer Correct ?    1 Yes 1 No
Ananth
 
 
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 3
127.As i is a char the last digit would be 127,so the loop 
stops at that point.
I crosschecked it writing a program.
 
Is This Answer Correct ?    0 Yes 1 No
Madhu
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 4
output is

-128
 
Is This Answer Correct ?    2 Yes 0 No
Rani
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 5
1
 
Is This Answer Correct ?    0 Yes 1 No
Mohmedali
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 6
0
 
Is This Answer Correct ?    0 Yes 1 No
Mohmedali
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 7
garbage values
 
Is This Answer Correct ?    0 Yes 1 No
Mohmedali
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 8
It will print 0 to 127
 
Is This Answer Correct ?    0 Yes 1 No
Rekha
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 9
infinte loop
 
Is This Answer Correct ?    0 Yes 1 No
Deepanjali
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 10
0 to 127
 
Is This Answer Correct ?    0 Yes 1 No
Gautam
 
  Re: What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Answer
# 11
-128 is correct answer
 
Is This Answer Correct ?    1 Yes 0 No
Rajendra.p (honeywell)
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
program to get the remainder and quotant of given two numbers with out using % and / operators? IBM4
C program code 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 Wipro4
What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?  1
what is the function of void main()?  4
hat is a pointer? Assurgent3
char ch="{'H','I',0};printf("%s",ch);what is output Accenture8
explain about storage of union elements. Bosch1
a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static Which of the Following Statements are true w.r.t Bit-Fields A)a,b&c B)Only a & b C)Only c D)All Accenture2
code snippet for creating a pyramids triangle ex 1 2 2 3 3 3  2
WRITE A PROGRAM TO FIND A REVERSE OF TWO NO  5
const char * char * const What is the differnce between the above tow?. TCS5
what is a far pointer TCS8
a C prog to swap 2 no.s without using variables just an array? TCS4
What will be result of the following program? void myalloc(char *x, int n) { x= (char *)malloc(n*sizeof(char)); memset(x,\0,n*sizeof(char)); } main() { char *g="String"; myalloc(g,20); strcpy(g,"Oldstring"); printf("The string is %s",g); } a) The string is : String b) Run time error/Core dump c) The string is : Oldstring d) Syntax error during compilation e) None of these IBM2
write a program to print the all 4digits numbers & whose squares must me even numbers? Virtusa1
why TCS selected more student in the software field from all institution. TCS3
what is the difference between const char *p, char const *p, const char* const p Accenture2
main() { int i,j,A; for(A=-1;A<=1;A++) prinf("%d\t",!!A); }  4
f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0;} value of c? Geometric-Software5
main() { char *p; p="Hello"; printf("%c\n",*&*p); } ME2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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