Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'do' keyword in C

Tags:

c

keyword

do is a keyword in C and all I have seen is that it is only used with while. So my question is can do be used alone without while.

If yes how?

like image 228
Shash Avatar asked Dec 16 '22 20:12

Shash


1 Answers

No. It cannot.

To be more precise, this is what the C standard has to say:

6.8.5 Iteration statements

Syntax

iteration-statement:

while ( expression ) statement
do statement while ( expression ) ;
for ( expressionopt ; expressionopt ; expressionopt ) statement
for ( declaration expressionopt ; expressionopt ) statement

like image 142
bitmask Avatar answered Jan 02 '23 15:01

bitmask