C - Getchar


Learn C - C tutorial - Getchar - C examples - C programs

C - getchar() - Definition and Usage

  • In C- Programming the getchar function is similar to the scanf statement, which will accept a character from the console file (console file is the output window where we can get the input values) or from a file, displays immediately while typing (after typing we need to press Enter key for proceeding).
C Get Char

C Syntax

Datatype getchar(void);

Sample Coding - Get Char

void main()
    char x;
    printf("Enter a character \n");
    printf("Given Character is %c \n",X);

C Code - Explanation

  1. In this statement we declare the variable “X” as char data type.
  2. In this statement we are getting the char value which will be stored in the variable “x”.
  3. Here the printf statement is used for printing the value of the variable”x”.

Output :

  1. Here in this output we get the character “W” and the character will be displayed using the printf statement in the console window of C.

View More Quick Examples

Related Searches to c get char

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.