C Language: getchar function
(Read Character)
In the C Programming Language, the getchar function reads a character from the stdin stream.
Syntax
The syntax for the getchar function in the C Language is:
int getchar(void);
Returns
The getchar function returns the character read. If an error occurs, the getchar function will set the stdin's error indicator and return EOF. If the getchar function encounters the end of stream, it will set the stdin's end-of-file indicator and return EOF.
Required Header
In the C Language, the required header for the getchar function is:
#include <stdio.h>
Applies To
In the C Language, the getchar function can be used in the following versions:
- ANSI/ISO 9899-1990
Similar Functions
Other C functions that are similar to the getchar function:
See Also
Other C functions that are noteworthy when dealing with the getchar function:
Advertisements