logo
Course thumb

The C programming language made simple

getc, getch, getche and getchar in C

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { int c = getch(); printf("Printed char: %c\n", c); c = getche(); printf("Printed char: %c\n", c); c = getc(stdin); printf("Printed char: %c\n", c); c = fgetc(stdin); printf("Printed char: %c\n", c); c = getchar(); printf("Printed char: %c\n", c); return 0; }