Hexadecimal in Array

I have 4 values ( hexadecimal ) in a Array:

int WIDTH[4];

Let say it is
11 0D 00 00

I have to tansform it into one only int: 285 [ 00 00 0D 11 ]

Someone have a clue to howto do that ? ( its for BMP image handling )
1
2
3
// assuming 'bytes' is your array

int width = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24);
Worked ! Thank You :D
If you know your program will only run on little endian CPUs, you can use
int width=*(int *)bytes;
Topic archived. No new replies allowed.