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
What is #include stdio h?
What is the concatenation operator?
Is c call by value?
Why n++ execute faster than n+1 ?
What is the size of structure in c?
What does dm mean sexually?
What is a const pointer in c?
Define Array of pointers.
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
What is a structure in c language. how to initialise a structure in c?
Explain what happens if you free a pointer twice?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
Difference between Shallow copy and Deep copy?
Are c and c++ the same?
Explain what is page thrashing?