警告:多字符常量[-Wmultichar] | [英] warning: multi-character character constant [-Wmultichar]|
问题描述
/* Beginning 2.0 */
#include<stdio.h>
main()
{
printf(" %d signifies the %c of %f",9,'rise',17.0);
return 0;
}
你好人
当我对此进行编译时,编译器会给出以下警告:
When I compile this, the compiler giving the following warning:
warning: multi-character character constant [-Wmultichar]|
并且输出仅打印 e
上升
。
C中不允许使用多个字符吗?
Are multiple characters not allowed in C?
如何打印整个单词(上升
)?
How can I print the whole word (rise
)?
请帮帮我。
推荐答案
尝试: printf(%d表示%f的%s,9, rise, 17.0);
。
C区分字符(一个字符)和字符字符串(可以包含任意数量的字符)。您使用单引号('')表示字符文字,但使用双引号表示字符 string 文字。
C distinguishes between a character (which is one character) and a character string (which can contain an arbitrary number of characters). You use single quotes (''
) to signify a character literal, but double quotes to signify a character string literal.
同样,您指定%c
来转换单个字符,但%s
转换字符串。
Likewise, you specify %c
to convert a single character, but %s
to convert a string.
这篇关于警告:多字符常量[-Wmultichar] |的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!