I was reading this and found the escape \?
. What does means exactly this escape? the literal ?
inside a string(I still can't see a reason) or is this a BNF grammar rule which I don't know about?

- 16,276
- 55
- 159
- 284
-
Read [Why is “\?” an escape sequence in C/C++?](http://stackoverflow.com/questions/19374878/why-is-an-escape-sequence-in-c-c) – Yu Hao Jun 30 '14 at 06:55
2 Answers
It specifies a literal question mark. see http://en.wikipedia.org/wiki/Digraphs_and_trigraphs
The backslash is used as a marker character to tell the compiler/interpreter that the next character has some special meaning. What that next character means is up to the implementation. For example C-style languages use \n
to mean newline and \t
to mean tab.
The use of the word "escape" really means to temporarily escape out of parsing the text and into a another mode where the subsequent character is treated differently.

- 24,694
- 15
- 58
- 73
It is used in a feature called trigraphs, it specifies a question mark. Using this you can write three-character sequence starting with question marks to substitute another character
From C11
C11 §6.4.4.4 Character constants Section 4
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 \.

- 168,305
- 31
- 280
- 331