为什么输出的不是"hello",而是“hello”
#include
int main()
{
char s[] = "\"hello\"";
printf("%s", s);
return 0;
}
\" 是特殊字符 ,会产生转义,变成 "
修改如下,供参考:
#include <stdio.h>
int main()
{
char s[] = "\\\"hello\\\"";
printf("%s", s);
return 0;
}
反斜杠\,在字符串里一般代表转义字符,想要输出\,必须对反斜杠进行转义,即\
"转义字符