A good post on this is
c - Multiple characters in a character constant - Stack Overflow
Basically, the important key idea is that a character constant in C is defined as an integer. A char is simply an integer that is one byte wide. So the statement
char magic_letter = 'a';
will do an implicit typecast from (int) on the right to (char) on the left.
An integer has an implementation-defined width and representation. Therefore, If I write this line in my code
the most likely result is that the string of characters "XYZ6" will appear somewhere in the binary output. Of course, the interpretation of these bytes as an integer is implementation defined, but there must be some mapping between character constants and integers.Code:static const int magic_code = 'XYZ6';