C For loop. In this lesson we discuss about for loops in C. We understand about initialization, test condition and increment decrements. ( ++b).So the value of b is first incremented from 2 to 3 and then assigned to c.Hence c becomes 3. This is one of the most frequently used loop in C programming. If there is a difference, then is it in the outcome/correctness or is it in the performance of both the loops ? It falls under the category of definite iteration. Try to understand the concept of the Java prefix and postfix. NOTE: Though increment and decrement operators mostly used in For Loop, While and Do-While loops. For loops, in general, are used for sequential traversal. The tradition developed, in C, of using post-increment when the expression value is not used, especially in for loops. Yes, you guessed it right! It's not as idiomatic as it is with the for-loop so most people will have to pause and read it carefully to make sure they understand exactly when the while-loop terminates and what the value of the variable will be after the loop. NOTE: Decrement and Increment operators in JS programming used in For Loop, While loop, and Do While loops. Some find post-increment easier to read, since the "subject" (i) precedes the "verb" (++), just like in English. There is no difference whether you use prefix or postfix form; the variable value will increase by 1. for ( init; condition; increment ) { statement(s); } Here is the flow of control in a 'for' loop − The init step is executed first, and only once. Try to learn the idea of the JavaScript prefix and postfix so that you can understand if, for loop, while loop and do-while loop syntax’s easy. ++ before the operand b i.e. Several variations of for loops … Then you must be wondering why there are two ways to do the same thing. Difference Between Pre-Increment and Post-Increment in C#. I would avoid pre-increment and post-increment operators in a while-loop condition as much as possible. A loop is used for executing a block of statements repeatedly until a given condition returns false. Definite iterations mean the number of repetitions is specified explicitly in advance. Here a and b are declared as integers and they are assigned to 5 and 2 respectively. So that you can understand if statement, for loop, while loop and do-while loop syntax easily. Pre and Post Increment - Java Example Programs . for (int i=0; i