c programming question on reinterpret_cast

Solution 1:

First, reinterpret_cast is a C++ operator. What you've shown is not that but a C-style cast.

The cast is converting a value of type unsigned int to a value of type char. Conversion of an out-of-range value is implementation defined, but in most implementations you're likely to come across, this is implemented as reinterpreting the lower order bytes as the converted value.

In this particular case, the low order byte of aNumber has the value 0x02, so that's what the result is when casted to a char.