换码顺序?在c ++ [英] Escape sequence for ? in c++
本文介绍了换码顺序?在c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在查看c ++中字符串中的字符的转义序列,我注意到有一个问号的转义序列。有人能告诉我为什么会这样吗?它只是似乎有点奇怪,我不知道什么?在字符串中。感谢。
I was looking at the escape sequences for characters in strings in c++ and I noticed there is an escape sequence for a question mark. Can someone tell me why this is? It just seems a little odd and I can't figure out what ? does in a string. Thanks.
推荐答案
这是为了避免将问号误解为 trigraph 。
It's to keep a question mark from getting misinterpreted as part of a trigraph.
例如,在
"What??!"
??将被解释为 |
字符,因此,您必须如下转义问号:
The "??! would be interpreted as the |
character. So, you have to escape the question marks as follows:
"What\?\?!"
http://msdn.microsoft.com/en-us/library/bt0y4awe%28VS.80%29.aspx
这篇关于换码顺序?在c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文