I have to do a small assignment for school. I am writing this in C. The question is:
Given
uint16_t A[] = { 0xabce, 0x43fe, 0xcf54, 0xffff };
uint8_t *p = (uint8_t *)&A[0];
What is the value of p[3]
?
I did some research and found that the numbers will be put back into my computer using little-endian. So
p[] = {171, 67, 207, 255}
However, when I print p[]
I get
p[0] = 206
p[1] = 171
p[2] = 254
p[3] = 67
I am very confused by this, can anyone please tell me why this is happening?