answersLogoWhite

0

What the syntax of for loop in c?

Updated: 8/20/2019
User Avatar

Wiki User

12y ago

Best Answer

for (<exp1>; <exp2>; <exp3>) <statement>

exp1 and exp3 are optional; statement can be null-statement or block-statement.

Correction:

All expressions are optional. An infinite loop has no expressions:

for(;;);

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What the syntax of for loop in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Syntax of for loop in c language?

for(i=0;i&lt;=0;i++)


What is the definition and syntax of for next loops?

loop within in a loop is called for next loop


Is it possible to use a for loop in place of a while loop?

Yes. while loop consist of only condition statement to make for loop look as while loop we can use syntax shown below: for(;condition;) eg: for(;i&lt;=n;)


Why you use colon in C language?

In C (and C++ and Java), the semicolon is used to mark the end of a statement. It is also used the separate the expressions in a for loop.


What is the syntax of foreach in c?

There is no 'foreach' in C


Which loop is also called an exit-condition loop in C programming?

The do while loop is also called an exit condition loop in c, c++, and java.


What is the difference between do while and for loop?

do { //statements }while(condition); The statements inside the block get executed at-least once, no matter what condition you have placed. Only from the 2nd time the condition is checked, simply because the condition is at the last. for(initialization; condition; updation) { //statements } Here the statements don't get executed even once if the condition fails initially. The condition is at the entry itself.


Is an infinite loop an example of a syntax error?

No. A syntax error is a statement that fails to compile. Infinite loops are simply loops for which the number of iterations is unknown. However, all loops, whether counted loops or infinite loops, must have a reachable exit condition. If a loop does not have a reachable exit condition then it is a logic error, not a syntax error.


What is the syntax of CD?

cmd c:


What is syntax in c?

syntax is the way you write your code in it defines the meaning of keywords &amp; how to write


How do you use if statement syntax in a for loop?

You can use any number of if staments within a for-loop, eg: for (i=0; i&lt;10; ++i) { if (i=1) printf ("%d=1\n",i); }


What are while loop in vb.net?

The while loop in vb.net uses the syntax form which provides a way to continue iterating while one or more conditions are true.