I asked on SO why C characters use `'` on both ends instead of just one (e.g. why not just `'a` instead of `'a'`?). This seems to have been the biggest reason.
I asked on SO why C characters use `'` on both ends instead of just one (e.g. why not just `'a` instead of `'a'`?). This seems to have been the biggest reason.
Multi-character constants are historical baggage.
You have to parse them the same way in a character literal as in a string literal, anyway.
I just figured out that
1. `\0` and octal numbers share the same prefix
2. Octal numbers can have 1-3 digits (not fixed)
So maybe it’s more tricky than I thought.
'\0' is just another octal escape sequence, not a special-case syntax for the null character.
"\0", "\00", and "\000" all represent the same value; "\0000" is a string literal containing a null character followed by the digit '0'.
Hexadecimal escape sequences can be arbitrarily long. If you need a string containing character 0x12 followed by the digit '3', you can write "\x12" "3".
It is more that it is an implementation detail of some compilers that was then (ab)used by certain platforms.