printf格式参数包含未定义的转义字符 [英] printf format parameter contain undefined escape character
本文介绍了printf格式参数包含未定义的转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include <stdio.h>
int main()
{
printf("Hello\c!\n");
return 0;
}
输出:<!code> Helloc
所以,当 \\ [some_undifined_symbol]
出现在的printf
的格式字符串,它只是忽略 \\
?
So , when \[some_undifined_symbol]
appeared in printf
's format string, it just ignore the \
?
推荐答案
\\ C
不是已定义一个转义序列,但最好避免使用它,因为它保留:
\c
is not an escape sequence that is already defined, but it's better to avoid using it because it's reserved:
小写字母为转义序列被保留用于未来的标准化。其他
字符可能扩展使用。
C99 §6.11.4 Character escape sequences
Lowercase letters as escape sequences are reserved for future standardization. Other characters may be used in extensions.
这篇关于printf格式参数包含未定义的转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文