In C/C++ why does the do while(expression); need a semi colon?

Because you’re ending the statement. A statement ends either with a block (delimited by curly braces), or with a semicolon. “do this while this” is a single statement, and can’t end with a block (because it ends with the “while”), so it needs a semicolon just like any other statement.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)