ARST1 - #include<stdio.h> # #include<string.h>...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<stdio.h> #include<string.h> # #define max 5 # struct customer { int cid; char name[30]; }; } void add(struct customer *a[], int *c) { //add struct customer *p; int i,flag=0; if(*c<(max-1)) { p=(struct customer *)malloc(sizeof(*p)); printf("\nEnter The customer ID:"); scanf("%d",&p->cid); printf("\nEnter The customer NAME:"); scanf("%s",p->name); for(i=0;i<=*c;i++) { printf("\nThe customer details are \n"); printf("Id:%d\n",a[i]->cid); printf("Name:%s\n",a[i]->name); if(p->cid==a[i]->cid) { printf("\nThe customer id already exists"); flag=1; break; } } if(flag==0) { (*c)++; a[*c]=p; } } else{ printf("Array is full");} } void del(struct customer *a[], int *c) { //delete struct customer *p; int i,y=0,z; p=(struct customer *)malloc(sizeof(*p)); printf("Enter the customer id to be deleted");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
scanf("%d",&p->cid); for(i=0;i<=*c;i++) { if(p->cid==a[i]->cid) { y=1; z=i; break; } } if(y==0) { printf("\nThe customer id does not exist"); printf("\nEnter the customer name to be deleted"); scanf("%s",p->name);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/25/2010 for the course CMPN SEM3 taught by Professor Thakur during the Fall '07 term at University of Mumbai.

Page1 / 5

ARST1 - #include&lt;stdio.h&gt; # #include&lt;string.h&gt;...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online