Use getche() to receive user selection : Console Output Char « Console « C / ANSI-C






Use getche() to receive user selection

  
#include <conio.h>
#include <stdio.h>

int main(void) {
  char ch;

  printf("Do you wish to continue? (Y/N : ");
  ch = getche();
  
  if(ch=='Y') {
   /* continue with something */
  
  }

  return 0;
}
           
       








Related examples in the same category

1.Simple printf demo
2.Output the char's ASCII code
3.Use getchar() to read user choices