3 ms·
Doesn't it have escape sequences for those because they're used in the language's syntax? Stands to reason, or is this even in string literals?
by zapzupnz 8y ago
Doesn't it have escape sequences for those because they're used in the language's syntax? Stands to reason, or is this even in string literals?
- klodolph 8y agoThey are alternative ways of writing the same character, unlike escape sequences, which have a different meaning from the unescaped version of the same character. For example, in C, I can write: int a<:10:>; Or I can write: int a[10]; They are the same, because <: is exactly the same as [, and :> is exactly the same as ] (except… mercifully, digraphs are not interpreted in strings; trigraphs are another story). However, in a string, the escape sequence \" means something different from ". One is a character in the string, the other ends the string. Digraphs and trigraphs exist because not all keyboards have the corresponding characters, like [ and ]. For example, look at a Swedish keyboard. (You can type [ and ], but not as easily, and maybe not at all on some older keyboards.)