#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;
}
contact[20]

is off the end of your array. The last element of your array is contact[19]

p=&cse2[10];

is off the end of your array. The last element of cse2 is cse2[9]

You need to read up on arrays and also the scanf function.

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.