GET EDUCATE

Contents
Basics of C Programming

⯈Basic C Programs

getchar function in C

  • getchar function is used to read a character from end user through the keyboard.
  • This is unformatted input function.
  • After it reads the character, it returns the ASCII value of it.
  • Prototype:
int getchar();

Example 1:

char ch;

getchar

ch = getchar();

It reads a character, from end user and stores in ch. 

If the entered character is A, then getchar function returns 65 (ASCII value of A)

getchar
Scroll to Top