uint32_t variable;
buffer[0] = 0;
buffer[1] = 1;
buffer[2] = 2;
buffer[3] = 3;
variable = ((buffer[0] << 24)| (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
When I used a 32bit varible the data type declearation i used was uint32_t ,please make sure that you use it otherwise use your declarations for uint8_t & uint32_t