getchar()

Prototype: int getchar(void);
Header File: stdio.h (C) or cstdio (C++)
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 <cstdio>
#include <iostream>

using namespace std;

int main()
{
  char a_char;
  a_char=getchar();
  cout<<a_char;
}
Other Functions