null_statement

null_statement

Just one semicolon with no instruction. Used in looping to not allow the loop to happen but no execution is needed in the body.

// dummy example
for (int i; i < 10; i++); // simply iterates through with no body.
for (d = 2; d < n && n % d != 0; d++); // a more real-world example of the null statement use case

Another and pretty much the only other use case for null statemtents are when adding jump_statement labels in a compound_statement

c

backlinks