So, I'm trying to convert an array of unsigned char
s into an uint32_t
, but keep getting different results each time:
unsigned char buffer[] = {0x80, 0x00, 0x00, 0x00};;
uint32_t num = (uint32_t*)&buffer;
Now, I keep getting this warning:
warning: initialization makes integer from pointer without a cast
When I change num
to *num
i don't get that warning, but that's not actually the real problem (UPDATE: well, those might be related now that I think of it.), because every time I run the code there is different results. Secondly the num
, once it's cast properly, should be 128
, but If I need to change the endianness of the buffer I could manage to do that myself, I think.
Thanks!