INADDR_ANY Does not create a random IP addresses, but rather it creates a special constant (0.0.0.0 in IPv4) used to indicate that the socket should bind to all available network interfaces.
This allows the server to accept connections on any of the host's IP addresses.
For which INADDR_ANY is a predefined constant, already in Network-Byte-Order. Therefore the use of "htons" isn't necessary at all.
[htons = host to network byte order, SHORT, 16-bit number.]
Furthermore, if you specify the IP directly with inet_addr() or inet_pton(), the function handles this conversion to network byte order for you, and will again not be necessary to use htons() or htonl().
As for why it only prints a single '0', the INADDR_ANY macro is defined as 0, and using %u (unsigned int) is appropriate for printing it. %d is for signed integer value, in other words, numbers which can be negative.
IN6ADDR_ANY, for IPv6, is the same functionality but for IPv6.
https://man7.org/linux/man-pages/man7/ip.7.html
https://www.ibm.com/docs/en/zos/2.4.0?topic=applications-special-ipv6-addresses