The syntax of this function is,
where, ch is a char type variable.
The following program shows how to use this function.
char ch = 'A';
Upon execution this program prints out A on screen.
getchar() is standard library function to get one character from keyboard. The getchar() function echo's the character on screen followed by enter key. The syntax of this function is
ch = getchar().
Both the functions are defined in stdio.h header file.