C++

// type of cast1 is uint8_t* // therefore, type of cast1[5] is uint8_t, so: uint8_t someByte = cast1[5]; uint32_t x = (uint32_t)someByte;

The cast shown above is

**not**reinterpret cast (in C++ terms). This is actually the conversion from smaller integer type to a bigger type, which is done the way the "semantic" (mathematical) values in both types would be the same (which is not always possible by converting bigger type to smaller, but always possible if you do the opposite, as in this case). In unsigned types (and even in more complex case of two's complement numbers) it takes zero value and fills in the least significant byte(s) from the source object (

`someByte`

).
—SA