I'm building an ipk for OpenWRT 24.10.0 that reads the interface IPs and does something with that information. The source code is written in c++, using g++ 9.4.0 and openwrt-sdk-24.10.0-octeon-generic_gcc-13.3.0_musl.Linux-x86_64 to build.
The inet_ntoa() function converts the Internet host address in, given in network byte order, to a string in IPv4 dotted-decimal notation. The string is returned in a statically allocated buffer, which sub‐sequent calls will overwrite.
You could split the output in two printf calls, or convert and copy the strings before calling printf, or use some other string conversion function.