EX.NO:4
ARRAY IMPLEMENTATION - LIST
PROGRAM #include<stdio.h> #include #include<string.h> static int n=0; const int MAX=50; void disp(); struct list { int no; char name[30]; }l1[50]; void create() { int n,i; for(i=0;i<20;i++) { l1[i].no=0; strcpy(l1[i].name," " ); } } void add() { if(n!=50) { printf("Enter the number:"); scanf("%d",&l1[n].no); printf("Enter the name:"); scanf("%s",l1[n].name); n=n+1; } else printf("The list is full"); disp(); } void del() { int num,i,j,x; printf("Enter the number to be deleted:"); scanf("%d",&num); for(i=0;i
{ l1[i].no=0; strcpy(l1[i].name," "); for(j=i;j
void main() { int ch; char c='y'; clrscr(); create(); do { printf("1.add\t 2.delete\t 3.modify\t 4.display\n"); printf("Enter your choice:"); scanf("%d",&ch); switch(ch) { case 1: add(); break; case 2: del(); break; case 3: modi(); break; case 4: disp(); break; default: printf("Enter the correct choice:"); break; } printf("Do you want to continue?(y/n):"); c=getch(); } while(c=='y'); getch(); }