Mega Code Archive

 
Categories / C / Language Basics
 

Use for loop as the user selections controller

#include <stdio.h> #include <conio.h> int main(void) {   int i;   char ch;   ch = 'a'; /* initial value */   for(i=0; ch != 'q'; i++) {     printf("pass: %d\n", i);     ch = getchar();   }   return 0; }