well, i have this code...
i have tried to run it but the compiler tells me that there are conflicting types in my code...
this code is not yet finished.
HELP!!!
#include<stdio.h>
#include<string.h>
#define max 20
typedef struct s_tag{
char name[50];
long mobilenum;
} contact;
void menu(contact c_array[]){
int option;
do{
printf("----------\n");
printf("Functionalities:\n");
printf("----------\n");
printf("[1] Add contact\n[2] Edit contact\n[3] Delete All contact\n[4] View All contact\n[5] Exit\n");
printf("Enter option: \n");
scanf("%d", &option);
switch(option){
case 1:
add(c_array);
break;
case 2:
edit(c_array);
break;
case 3:
deleteall(c_array);
break;
case 4:
viewall(c_array);
break;
default:
return;
}
}while(option!=5);
}
void edit(contact c_array[]){
int y,i,j;
printf("Enter mobile number you want to change: \n");
scanf("%d", &j);
for(i=0;i<max;i++){
if(j==c_array[i].mobilenum){
printf("Enter the information you want to edit.\n");
printf("[0] Name\n[1] Phone Number\n");
scanf("%d",&y);
if(y==0){
printf("Enter new Name: \n");
scanf("%s",c_array[i].name);
}
else if(y==1){
printf("Enter new Phone Number: \n");
scanf("%s",&(c_array[i].mobilenum));
}
}
}
}
int main(){
contact c_array[max];
menu(c_array);
return;
}
Hi ,
I have made some changes in the code
you have to write delete all function and viewall function , now this should work .
please follow the proper indents .