getchar is a function in the C programming language that reads a single character from the standard input stream stdin, whatever it is, and returns it to the program. Let's take a closer look at the content of the getchar function.
The syntax of getchar function
int getchar(void)
The usage of getchar function
The code is as follows
#include <stdio.h> int main () { char c; printf("Enter character: "); c = getchar(); printf("Character entered: "); putchar(c); return(0);}
Compiling and running the above program will produce the following results:
Enter character: a Character entered: a
The above is the detailed content of What does getchar mean?. For more information, please follow other related articles on the PHP Chinese website!