I have a byte array and I need to convert the first two bytes to an integer as though they're one byte, but they have to be read backwards.
ie. The first byte is A1 and the second byte is B2. I need to convert them as B2A1.
Thanks ahead of time. :)
Regardless of platform, you can do unsigned long a=array[0]|(array[1]<<8);
and it will always work (unless sizeof(unsigned long)<2).
Last edited on
Thanks helios, you too jsmith.