C examples for Data Type:char
You can read a single character using the scanf() function with the format specifier %c.
To write a single character to the command line with the printf() function, use the format specifier, %c.
#include <stdio.h> int main(void) { char ch = 0;/* www.ja va 2s . c om*/ scanf("%c", &ch); // Read one character printf("The character is %c\n", ch); return 0; }