C examples for Data Type:char
Use scanf() to read the keyboard for a single character, specified by the placeholder %c.
#include <stdio.h> int main()// w ww . j a v a 2 s . c o m { char key; puts("Type your favorite keyboard character:"); scanf("%c",&key); printf("Your favorite character is %c!\n",key); return(0); }