|
|
|
|
|
by _kst_
1138 days ago
|
|
In the declaration char letter = 'x';
the initialization expression 'x', which for historical reasons is of type int in C, is implicitly converted to the type of the object. `letter` is a `char` because you defined it that way.If you had written int letter = 'x';
that would be perfectly valid, and the conversion would be trivial (int to int).It's just like: double x = 42;
`sizeof 42` might be 4 (sizeof (int)), but `sizeof x` will be the same as `sizeof (double)` (perhaps 8). |
|