#include <stdio.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/socket.h>
#include <string.h>

int main() {
    int rc;
    struct hostent *pHostEnt;
    char name[90];
    int      i = 0;
    //struct sockaddr_in   dest;
    struct   in_addr sin_addr;

    pHostEnt = gethostbyname("www.yahoo.com");
    while ( pHostEnt->h_addr_list[i] ) {
      /* sin_addr.s_addr = *(long*)(pHostEnt->h_addr_list[i]); */
       memcpy(&(sin_addr), pHostEnt->h_addr_list[i], pHostEnt->h_length);
       printf("IP address is: %s\n", inet_ntoa(sin_addr));
       i++;
    } 
}
