可以使用scanf()函数读取单个字符,格式说明符为%c。要使用printf()函数将单个字符写入命令行,请使用格式说明符%c

#include <stdio.h> 

int main(void) 
{ 
    char ch = 0;
    scanf("%c", &ch);                           // Read one character

    printf("The character is %c\n", ch);

    return 0; 
}