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                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
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=0;i=printf("Hello");i++);
printf("Hello");
how many times how will be printed?????????
 Question Submitted By :: Minakshi
I also faced this Question!!     Rank Answer Posted By  
 
  Re: for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????
Answer
# 1
here the basic thing we must understand is that :

printf(); is a function. this printf() always returns the
number of character it processes inside " ".......here it
will return 4 according to me... this will will be assigned
to i and everytime 'i' will be a non zero value always and
also a semicolon is placed after for statement , so compiler
takes that has the next line and PRINTS "HELLO" INFINITELY
since 'i' value is always non zero or always TRUE...

and there is no way for the second printf() to get printed
according to me......... 



thank u
 
Is This Answer Correct ?    12 Yes 2 No
Vignesh1988i
 
  Re: for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????
Answer
# 2
Infinite times
i =printf("Hello");
here printf("hello") will return 5 i.e i=5 which will always
remain true that's why hello will be printed infinate times.
 
Is This Answer Correct ?    10 Yes 3 No
Ruchi
 
 
 
  Re: for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????
Answer
# 3
for(i=0;i=printf("Hello");i++);
means
for(i=0;i=printf("Hello");i++)
{
   
}
thats why it will print     Hello     only one time.
 
Is This Answer Correct ?    0 Yes 3 No
Asit Mahato
 
  Re: for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????
Answer
# 4
"Hello" will be printed infinite time.......
 
Is This Answer Correct ?    0 Yes 0 No
Anandi
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Program to find the value of e raised to power x using while loop N-Tech3
How can we see the Expanded source code and compiled code for our source program in C?  1
what does " calloc" do? Cadence6
void main(int argc,char *argv[],char *env[]) { int i; for(i=1;i<argc;i++) printf("%s",env[i]); }  2
What's wrong with "char *p = malloc(10);" ?  4
In the following code segment what will be the result of the function, value of x , value of y { unsigned int x=-1; int y; y = ~0; if(x == y) printf("same"); else printf("not same"); } a) same, MAXINT, -1 b) not same, MAXINT, -MAXINT c) same , MAXUNIT, -1 d) same, MAXUNIT, MAXUNIT e) not same, MAXINT, MAXUNIT IBM1
7. Identify the correct argument for the function call fflush() in ANSI C: A)stdout B)stdin C)stderr D)All the above Accenture8
what is link list?  2
what is c? Tech-Mahindra5
can we write a program in c for printf and scanf without using header file stdio.h  1
what is the use of fflush() function?  1
What is RAM memory? and What is ROM?Who designed one is temparary and another is permanent?why they designed like that?By using far pointer which type data(whether hexadecimal)we can access? Excel1
write a “Hello World” program in “c” without using a semicolon?  3
What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?  1
plz answer.... write a program that reads line (using getline) e.g."345", converts each line to an integer using "atoi" and computes the average of all the numbers read. also compute the standard deviation.  1
what are the general concepts of c and c++  1
How can I convert integers to binary or hexadecimal?  2
related to rdbms query .  1
how to implement stack work as a queue?  2
what is a function pointer and how all to declare ,define and implement it ??? Honeywell3
 
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