I am facing a following problem: When trying to do cast to an unsigned char I get unexpected values. The code that I am using:
unsigned char MyVal1 = ((0xF1E3 && 0xff00) >> 8);
unsigned char MyVal2 = (unsigned char)((0xF1E3 && 0xff00) >> 8);
unsigned char MyVal3 = (unsigned char)((0xF1E3 && 0xff));
I am storing all three variables in an array.
The output I am getting (looking at the values in array; array is unsigned char array):
0x00
0x00
0x01
while I was expecting:
0xF1
0xF1
0xE3
Could someone be kind to help me out in what am I doing wrong?