Im trying to convert little endian to big endian and having trouble. I have an array that has 2 bytes of unsigned char which is hex values. and i would like to make it big endian by the zeros are gone and i cant get the values i want.
For example, My goal is to get
array[0] = 0b
array[1] = 40
output = 0b40 so i can see this value as 2880 when %d
so i used
output = (array[1]>>4) | (array[0]<<4);
but in reality, i see
printf("output = %x04\n", output);
output = 00b4
I want that output to be 0b40 so i can get 2880 when i do
printf("output = %x\n", output);
output = 0b40
printf("output = %d\n", output);
output = 2880
thanks guys any help will be appreciated