how does the for loop work actually..suppose for the
following program how it ll work plz explain to me
for(i=5;i>=0;i--)
prinf(i--);
Answer Posted / shikhar
The answer given by preshit is absolutely correct...Lets
see how ,we have >>>
for(i=5;i>=0;i--)
Now we can write this all as :
//start of program
STEP 1 : for(i=5;i>=0;)
{
STEP 2 : prinf(i--);
STEP 3 : i--;
}
//end of program
TT : now the loop will start with i=5
when control reaches printf it firstly executes its
internal statement i.e i-- and then prints i-1(i.e 4) and
it Reduces i by 1.i becomes 3
NOW once again STEP 1 :go to TT
OUTPUT :
4
2
0
| Is This Answer Correct ? | 2 Yes | 14 No |
Post New Answer View All Answers
Differentiate between #include<...> and #include '...'
What is an auto variable in c?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
write a programming in c to find the sum of all elements in an array through function.
There seem to be a few missing operators ..
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What is variables in c?
What does the error 'Null Pointer Assignment' mean and what causes this error?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
How do I read the arrow keys? What about function keys?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
When should the volatile modifier be used?
What is the purpose of 'register' keyword?
What is the return type of sizeof?
Why can’t we compare structures?