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

How can I avoid the abort, retry, fail messages?

663


What is double pointer?

560


What is a char c?

592


Write a program to swap two numbers without using the third variable?

597


What are the string functions? List some string functions available in c.

605






Is multithreading possible in c?

568


why do some people write if(0 == x) instead of if(x == 0)?

654


What is getch () for?

679


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1468


What is bubble sort in c?

639


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

941


What are the types of data files?

729


What is bin sh c?

582


Explain how do you print an address?

659


What is function prototype in c language?

617