C - Single Character Input


getc() function in stdio.h reads a single character from a stream.

It returns the character code as type int.

The argument to getc() is the stream identifier.

When the end of a stream is read, getc() returns the value EOF (end of file).

EOF is a symbol that is defined in stdio.h as a negative integer.

getchar() function reads one character at a time from stdin and is equivalent to calling getc() with stdin as the argument.

The getchar() function is defined in stdio.h, and its prototype is:

int getchar(void);

The getchar() function requires no arguments, and it returns the code for the character read from the input stream as type int.