Technically, no. But why are you using htons
? It changes the endianess of a 16 bit datum to big-endian (that is, network byte order). First is your variable not 16 bit but 32 bit, so uint16_t acc = 0xBBD1
would be more appropriate. Second, as your on a little-endian machine, the bytes are exchanged, hence the output.
1
solved How to inverse an integer in C?