Let's say I have the following code lines:
int a; // 4-byte-integer
char b, c, d, e;
b = (char)(a >> 24);
c = (char)(a >> 16);
d = (char)(a >> 8);
e = (char)a;
Let's also assume that the system is storing the bytes in little-endian mode and a = 100
.
When using the explicit cast like that, do the left-most bytes disappear?
I guess that after executing the above lines, the variables will hold these values: b=100, c=0, d=0, e=0
. Is it right?