for(i=0;i=printf("Hello");i++);
printf("Hello");
how many times how will be printed?????????
Answers were Sorted based on User's Feedback
Answer / ruchi
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 ? | 23 Yes | 6 No |
Answer / vignesh1988i
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 ? | 18 Yes | 5 No |
Answer / kalyan chukka
Here in the loop it given as i=0;i=printf("Hello");
So Printf function returns how many no of charecters it
printed so it takes 5 so loop is
for (i=0;i=5;i++) so loop will be this
in the above loop first i=0 and then we assign i=5 so loop
will become for(i=5;i++) it becomes infinite loop hello
printed infineite loop.
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / m.manivel
Hello will be printed infinite times and if u want to print
10 times for put i=10;(or)print for 100 times put i=100;for
user choice
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / asit mahato
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 ? | 2 Yes | 14 No |
Can you return null in c?
What's wrong with "char *p; *p = malloc(10);"?
why you will give me a job in TCS.
Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don't use printf statements;use two nested loops instead. you will have to use braces around the body of the outer loop if it contains multiple statements.
What are the advantages and disadvantages of pointers?
Implement a function that returns the 5th element from the end in a singly linked list of integers in one pass.
What is uint8 in c?
Explain the use of 'auto' keyword in c programming?
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
Taking an example,differentiate b/w loader and linker ?
Input is "Jack and jill went up a hill" To print output is 1-letter word(s)-1 2-letter words-1 3-letter words-1 4-letter words-4
can v write main() { main(); } Is it true?