问题
#include <stdio.h>
int main()
{
printf("Hello\c!\n");
return 0;
}
Output : Helloc!
So , when \[some_undifined_symbol] appeared in printf 's format string, it just ignore the \ ?
回答1:
\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.
回答2:
You have the following escape sequences defined for c:
\'single quote\"double quote\\backslash\0null character\aaudible bell\bbackspace\fform feed - new page\nline feed - new line\rcarriage return\thorizontal tab\vvertical tab\nnnarbitrary octal value\xnnarbitrary hexadecimal value
来源:https://stackoverflow.com/questions/18718787/printf-format-parameter-contain-undefined-escape-character