How to output characters in the C language.
In C language, you can use the printf function to display characters. The specific syntax format is:
printf("%c", character);
%c is a formatting control symbol used to specify outputting a character, where ‘character’ is the character to be outputted.
The sample code is as follows:
#include <stdio.h>
int main() {
char ch = 'A'; // 定义一个字符变量
printf("%c\n", ch); // 输出字符A
return 0;
}
The result of the operation is:
A
Please note that in the printf function, %c can only be used to output a single character. If you want to output a string (multiple characters), you need to use the %s format specifier.