我有一个由4个元素组成的数组,类型为unsigned char。如何将它们合并为一个十六进制值?我需要将此值转换为IEE754值。
例如unsigned char arr[]={0x41,0xD9,0xD4,0x03}
预期o / p:0x41D9D403
答案 0 :(得分:1)
unsigned long hex_val = ((unsigned long)arr[0] << 24) | ((unsigned long)arr[1] << 16) | ((unsigned long)arr[2] << 8) | ((unsigned long)arr[3]);