5.6.3.2. Do-Loops (optional)

A do-loop differs from a while loop in two key points. First, a do-loop's body is performed one or more times rather than zero or more times. Second, the test that determines whether to do the loop body again is done at the bottom of the loop instead of at the top. The general form is

  do
  {
    statements
  } while (condition);
If the condition is true (or nonzero) at the end of the loop, the loop body is done again, and it keeps being repeated until the condition is found to be false (0). For example,
  int n;
  do
  {
     n = getchar();
     if(n != EOF)
     {
       printf("%c", n);
     }
  } while(n != EOF);
copies the standard input to the standard output.