Home >Common Problem >What does getchar mean?

What does getchar mean?

不言
不言Original
2019-02-22 15:41:5933418browse

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.

What does getchar mean?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What protocol is Telnet?Next article:What protocol is Telnet?