#include<stdio.h>
#include<string.h>\
struct name
{
char contact[20];
long int no;
};
int main()
{
int i,check;
char ch[20];
struct name cse2[10],*p;
p=&cse2[10];
for(i=0;i<10;i++)
{
printf("Please enter contact name: ");
scanf("%s",&(p+i)->contact[20]);
printf("mobile no: ");
scanf("%ld",&(p+i)->no);
}
printf("Please enter a contact name to find his\\her mobile no: ");
gets(ch);
for(i=0;i<10;i++)
{
check=strcmp(ch,(p+i)->contact[20]);
if(check==0)
{
printf("Contact name:%s",(p+i)->contact[20]);
printf("Mobile no:%ld",(p+i)->no);
break;
}
}
return 0;
}
anirudhruia 0 Newbie Poster
Moschops 683 Practically a Master Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.