DNS(Domain Name System) Program in UNIX

#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<netdb.h>
#include<stdio.h>
#include<stdlib.h>
int main()
{
int choice,i;
char name[50];
struct hostent *h;
struct in_addr **addr_list;
struct in_addr addr;
printf("\n HOST");
printf("\n1.Name");
printf("\n2.Address");
printf("\n Exit");
printf("\nEnter your Choice");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nEnter the name of the host");
scanf("%s",&name);
h=gethostbyname(name);
if(h==NULL)
{
printf("\n host name does not exist");
printf("%s",h_errno);
exit(0);
}
printf("\n The Ip address is %s",inet_ntoa(*(struct in_addr *)h->h_addr));
break;
case 2:
printf("Enter the Ipaddress");
scanf("%s",&name);
if(inet_aton(name,&addr)==0)
{
printf("%s Ip address is not valid",name);
exit(0);
}
h=gethostbyaddr(&addr,sizeof(addr),AF_INET);
printf("\n Host name is %s",h->h_name);
break;
printf("\n  Address type ois %d",h->h_addr);
printf("\n Length is %d",h->h_length);
for(i=0;h->h_aliases[i]!=NULL;i++)
{
printf("\n Aliasname %d is %s",1+1,h->h_aliases[i]);
}
addr_list=(struct in_addr**)h->h_addr_list;
for(i=0;addr_list[i]!=NULL;i++)
{
printf("\n Address list is %s",inet_htoa(*addr_list[i]));
}
return 0;
}
}