C – Getchar 2017-08-05T19:28:40+00:00

Getchar() :

getchar() function will accept a character from the console or from a file, displays immediately while typing and we need to press Enter key for proceeding.

Syntax :
int getchar(void);
It returns the unsigned char that they read.If end-of-file or an error is encountered it return EOF.

This function reads a single character from the standard input device, the keyboard being assumed because that is the standard input device, and assigns it to the variable “a”.

C – EXAMPLE PROGRAM :

Output :

Enter a character

C

Given character is C

Prev Next