On do statement [closed]

In the C specification the do iteration statement is written alone, not as do/while.

This is not correct. C11 6.8.5 Iteration statements:

iteration-statement:
  while ( expression ) statement
  do statement while ( expression ) ;
  ...

Why, maybe because are they, in that context, two separate statements?

No, do-while is one statement as specified by the syntax cited above. It is sometimes referred to as the do statement (as it is in 6.8.5.2), but the while on the end is mandatory, as it is part of the same statement.

Is this also explain the ; character put at the end of the while?

No, the ; is there because it is required by the syntax cited above.

Browse More Popular Posts

Leave a Comment