C program for 2-D array
Write a ‘C’ program to accept ‘n’ names from user store these name into 2-D array. Accept the name from user and search whether the name is present in an array or not. #include<stdio.h> #include<conio.h> void main() { char name[5][10],res[10]; int i,j,n; clrscr(); printf("enter the no"); scanf("%d",&n); printf("enter the matrix element"); for(i=0;i<n;i++) { for(j=0;j<n;j++) { scanf("%s",&name[i][j]); } } for(i=0;i<n;i++) { for(j=0;j<n;j++) { printf("enter the name"); scanf("%s",&res); if(strcmp(&name[i][j],&res)!=0) { printf("name is not found"); break; } else { printf("name is found"); } } } getch(); }