Do while loop in turbo c?

do {
// statement;
} while (expression);

The statement body is executed at least once. At the end of each iteration, the expression is evaluated. If false (or 0), the loop terminates. If true (or non-zero), the statement body executes another iteration.

Like any other loop structure, a do loop can be terminated by a break or return statement within the statement body. If a continue statement is encountered within the statement body, execution passes to the while clause where expression is re-evaluated.

To understand how a do loop differs from a while loop, compare the following:

int x;

x = 0;
do {
printf ("%d ", ++x);
} while (x<10);
printf ("\n");

x = 0;
while (x<10) {
printf ("%d ", ++x);
};
printf ("\n");

Output:
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9

Note that the while loop does not print the value 10. This is because the control expression (x<10) is evaluated before each iteration begins. In a do loop, it is evaluated after each iteration has finished.