I encountered a strange problem when casting and modifying pointers on a 32bit embedded system (redbee econotag running contiki OS to be specific).
uint32_t array[2];
array[0] = 0x76543210;
array[1] = 0xfedcba98;
uint8_t* point = ((uint8_t*)array)+1;
printf("%08x \n", *(uint32_t*)point );
output on my computer:
98765432
output on embedded device:
10765432
My computer behaves as I expect it to, the embedded device however seems to wrap around when it reaches the end of the word. Why does this happen?