Understanding the do-while loop in C Language
Do While Loop in C Language: This is the third and final Loop used in "C". Like all other Loop, all three basic statements are required, ie the initial value, final value and step size of Loop's Variable. The feature of this Loop is that it checks at the end of the Condition Loop to be checked.
That is, when we need to execute the statement or Statement Block of Loop in the program at least once, then we use this Loop. Syntax of this Loop is as follows:

This Loop starts with do Keyword and is given a while condition after closing the middle bracket after the Statement Block. Also, this is the Loop, with the condition of while after the bracket; (Semi-Colon) is used. No colon or Semi-Colon is used after do. As soon as the do keyword is received to the program control in this loop, the program control goes directly into the do statement block and executes the statements written in it... Then the step size of Variable running Loop does as per Increase or Decrease program.
When the Program Control comes out of this block, it gets the while condition. Here, if Condition is true then Program Control executes the Statements back from do and if Condition is false, Program Control does not Iterate the Loopback but goes directly to Statement 1.

Comments
Post a Comment