Diff between for loop and while loop?

Answer Posted / naresh lingampally

In both the loops the Out put is same.... but the compile
structure is different:

i.e..,
syn: for(i=0;i<=10;i++)
{
statement;
}

while(i<=10)
{
statement;
i++;
} .

i=0; --> initialization.---{1)
i<=10;---> conditioning ---(2)
i++; ---> incrementation ---(3)


in (while) the compiler order would be
(1) .. not along with the loop
(2),(3) in the loop

but in (for) the order is (1),(2),(3) in a single statement.

NOTE: MAJOR DIFFERENCE IS WE CAN REDUCE THE LENGTH OF THE
PROGRAM (FOR) NAD IS MORE SOPHISTICATED.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data structure in c programming?

786


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

917


Why we write conio h in c?

754


hi, which software companys will take,if d candidate's % is jst 55%?

1854


Why doesnt that code work?

779


In C language what is a 'dangling pointer'?

827


What is header file definition?

806


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

2511


what are the advantages of a macro over a function?

863


What is operator promotion?

808


Is exit(status) truly equivalent to returning the same status from main?

811


void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

2496


Explain what is the benefit of using const for declaring constants?

788


How does struct work in c?

803


Can true be a variable name in c?

737