Search code examples
cescapingconstantsliteralsbnf

What does mean \? escape in C grammar?


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?


Solution

  • 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.