Getchar

Prototype: int getchar(void);
Header File: stdio.h
Explanation: This function reads in a character. It returns the character as the ASCII value of that character. This function will wait for a key to be pressed before continuing with the program.
Example:

//Example waits for a character input, then outputs the character
 
#include <stdio.h>
#include <iostream.h>
int main()
{
  char a_char;
  a_char=getchar();
  cout<<a_char;
  return 0;
}                                     
 
Home