That's because dt
is a pointer so when you cast it to uint32_t
you just take its address as the value that will be stored in _Recv
.
You should try casting it to a uint32_t
and then dereference it:
uint32_t _Recv = *((uint32_t*)dt)
so that the address will be interpreted as a pointer to an unsigned int
.
A more readable approach would be to build the value with shifts:
uint32_t _Recv = dt[3]<<24 | dt[2]<<16 | dt[1]<<8 | dt[0];
This will also allow you to manage endianness as you wish.