asked 138k views
5 votes
What function do you use to convert a short integer in network byte order to the machine byte order?

a) `htonl()`
b) `ntohs()`
c) `htons()`
d) `ntohl()`

asked
User Nonyme
by
9.5k points

1 Answer

3 votes

Final answer:

The function used to convert a short integer from network byte order to the machine's byte order is ntohs(). It stands for Network TO Host Short.

Step-by-step explanation:

To convert a short integer from network byte order to the machine's byte order, you use the function ntohs(). The acronym stands for Network TO Host Short. Other functions like htonl() convert from host to network long, htons() convert from host to network short, and ntohl() convert from network to host long, but for a short integer in network byte order, the correct choice is ntohs().

answered
User Walter A
by
8.5k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.