What is the difference between while and do while loop in C?
| while | do while |
|---|---|
| Condition is checked first | Body runs first, condition is checked after |
| Body may run zero times | Body runs at least one time |
| No semicolon after the condition | Semicolon after while (condition); |
Example: with int x = 10; and the condition x < 5, a while loop prints nothing, but a do while loop prints once. See do while loop.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |