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(;;);
for(i=0;i<=0;i++)
loop within in a loop is called for next loop
The syntax for writing a loop in pseudo code typically involves using keywords like "for", "while", or "do-while" to indicate the type of loop, followed by the loop condition and the code block to be executed within the 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<=n;)
There is no 'foreach' in C
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.
The do while loop is also called an exit condition loop in c, c++, and java.
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.
Its similar to a number of languages such as C, C++, Java and Perl.
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.
cmd c:
syntax is the way you write your code in it defines the meaning of keywords & how to write