+ -
当前位置:首页 → 问答吧 → 转义字符\?为何而生

转义字符\?为何而生

时间:2010-08-22

来源:互联网

感觉完全没有必要啊?

?难道还有什么特殊用处吗?还需要转义?

作者: efolzl   发布时间: 2010-08-22

如果在字符串字面值中要表示问号,既可以使用转义序列\?,也可以直接用字符? 但是有个三目运算符 test? a:b, 是为了区别这个?

作者: linfenghuaster   发布时间: 2010-08-22

“test?a:b”

完全没有问题啊~

作者: efolzl   发布时间: 2010-08-22

ISO99这样写的 ,也没提,
The double-quote " and question-mark ? are representable either by themselves or by the escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
shall be represented, respectively, by the escape sequences \' and \\.

作者: linfenghuaster   发布时间: 2010-08-22