Home > Common Problem > body text

What does getchar mean?

不言
Release: 2019-02-27 09:08:01
Original
33379 people have browsed it

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)
Copy after login

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);}
Copy after login

Compiling and running the above program will produce the following results:

Enter character: a
Character entered: a
Copy after login


The above is the detailed content of What does getchar mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template