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 / devi dayal jangra

syntax error.... in prinf...but it should be corrected then
the result will be
5
3
1
Note ...
in first run I=5; printf(i--) print I which is 5 and store 4
in i.
in second run i-- means 4-1=3 then printf(i--) print 3 and
store 2 in i.
in third run... i-- measn 2-1=1 then printf(i--) print 1 and
store 0 in i.
then decreament statement i-- store 1=-1 and when compare
-1>=0 become false and goto next statement after that loop.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the similarities between c and c++?

841


Explain the process of converting a Tree into a Binary Tree.

2443


what will be maximum number of comparisons when number of elements are given?

1697


Explain what is the purpose of "extern" keyword in a function declaration?

851


What is the use of function overloading in C?

932


Is it valid to address one element beyond the end of an array?

960


What does d mean?

818


write a proram to reverse the string using switch case?

2725


What does %p mean?

858


Can we assign string to char pointer?

848


Is fortran still used today?

834


what are non standard function in c

1686


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

873


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

1991


What do header files do?

851