Do statement
A do statement is a loop construct that executes its body before testing a condition, so the body runs at least once.
Modern C, Third Edition
A do-while loop is a C iteration statement that executes its body once and then repeats it while its controlling condition is true.
- How it is used
- Deploys post-tested iteration when an operation must execute before deciding whether repetition should continue.
- How deep it goes
- Defines syntax and execution order, demonstrates a numerical loop, and stops short of deeper control-flow mechanics.
- Examples
- Demonstrates Heron's approximation for a multiplicative inverse using a precision threshold and repeated updates.
- What you can do after
- Apply it via C syntax to repeat a body at least once and terminate after a condition becomes false.
Modern C
A do-while loop is a C iteration construct that executes its dependent statement before testing whether its condition remains true.
- How it is used
- Uses post-condition iteration when an operation must occur before deciding whether repetition should continue.
- How deep it goes
- Defines syntax, contrasts do with while, and demonstrates a numerical rewrite without developing implementation internals.
- Examples
- Demonstrates do by rewriting Heron’s approximation for computing multiplicative inverses.
- What you can do after
- Apply via C syntax to place a continuation test after an iteration body.
Related concepts
- loopkind of · A loop is a programming control-flow construct that repeatedly executes a block of instructions according to an iteration rule or continuation condition.
- infinite loopproduces · An infinite loop is a control-flow cycle that continues without reaching a normal termination point unless an exit condition or external intervention stops it.
- type-generic macroused by · A type-generic macro is a macro-based interface whose expansion selects or adapts operations according to the types of its arguments or associated objects.
- do-while(false) trickimplemented by · The do-while(false) trick is a macro-structuring technique that encloses multiple statements in a single statement-like construct.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

