Consider the following code snippet:
uint8_t addr[4];
inet_pton(AF_INET, args.gtp_bind_addr.c_str(), addr);
The function inet_pton() takes an IP-address in dotted decimal form (args.gtp_bind_addr.c_str()), converts it into an in_addr struct and copies this struct to addr.
Now, assume I am given a sockaddr_in struct, let's call it help. And I want to write the addr_in entry of help into my addr array. Would this be possible simply by the following command:
addr[0] = help->sin_addr ?
This seems a little wrong as I am now assigning the sin_addr just to addr[0], but I want it to fill the entire addr array.