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

writ a program to compare using strcmp VIVA and viva with its output.

1512


What does %d do?

708


What is restrict keyword in c?

635


What is the use of pragma in embedded c?

583


Why is c so popular?

640






what is a NULL Pointer? Whether it is same as an uninitialized pointer?

750


What is variables in c?

598


What is c language used for?

551


Explain high-order and low-order bytes.

659


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

1244


What is meant by operator precedence?

664


Where register variables are stored in c?

536


What is wrong in this statement?

595


any "C" function by default returns an a) int value b) float value c) char value d) a & b

656


What is printf () in c?

574