Put function into while loop condition statement : While Loop « Statement « C Tutorial






#include <stdio.h>
 
int main()
{
    puts("Start typing.");
    puts("Press ~ then Enter to stop");
 
    while(getchar() != '~')
        ;
    printf("Thanks!\n");
    return(0);
}
Start typing.
      Press ~ then Enter to stop
      a
      a
      a
      a
      a
      a~
      Thanks!








6.7.While Loop
6.7.1.The while loop
6.7.2.Between a while loop and a for loop
6.7.3.Put function into while loop condition statement
6.7.4.While loop and sum integers
6.7.5.while loop nested in a for loop