You are here : cpp0getchar

getchar() - 0

The C library function int getchar(void) gets a character (an unsigned char) from stdin. This is equivalent to getc with stdin as its argument.


Syntax

int getchar(void)


Example

#include <stdio.h>

int main ()
{
   char c;
 
   printf("Enter character: ");
   c = getchar();
 
   printf("Character entered: ");
   putchar(c);

   return(0);
}


Output / Return Value

Enter character: a
Character entered: a


Limitations

Nothing


Alternatives / See Also

Nothing


Reference