Posts

Showing posts with the label endianness

why ntohs(1byte_variable) works fine?

Image
Clash Royale CLAN TAG #URR8PPP why ntohs(1byte_variable) works fine? uint8_t var = 9; var = ntohs(var); the same piece of code yields var value as 0 aswell 9. As of my guess, as we can't apply ntohs on 1 byte filed!! can we? is there any case?. how could final value of var after ntohs yields 9. my linux machine is Little Endian ,x86 architecture, Intel Thanks for your answer in advance. I don't understand the difference between "in my project" and "i tried". – Eugene Sh. 7 mins ago the same code var value results once 0 aswell 9 also. – aaripaka prashad 5 mins ago ...