On Linux, see constant INET6_ADDRSTRLEN
(include <arpa/inet.h>
, see man inet_ntop
). On my system (header "in.h"):
#define INET6_ADDRSTRLEN 46
The last character is for terminating NULL, as I belive, so the max length is 45, as other answers.