C - Do-While Loop
The do-while loop executes the body at least once, then repeats while the condition is true.
Learning Objectives
- Use do-whilefor input-validation and menu loops.
Prerequisites
Example
#include <stdio.h>
int main(void) {
    int i = 0;
    do {
        printf("%d\n", i++);
    } while (i < 3);
}
Checks for Understanding
- How many times does the loop body run if the condition is initially false?
Show answers
- Once.