Use getchar() function to read a single character from key board - C Data Type

C examples for Data Type:char

Description

Use getchar() function to read a single character from key board

Demo Code

#include <stdio.h>
int main()/*from w  ww  .  j  a  va 2s  . c  om*/
{
   char key;
   puts("Type your favorite keyboard character:");
   key=getchar();
   printf("Your favorite character is %c!\n",key);
   return(0);
}

Result


Related Tutorials