Here is was I am trying todo I am calling a function within a function and passing to it a few things an array, a couple of ints and a string I am getting an error on the string when I call it from the function and try to place it in a struct I have include the function I am having problems and the struct. The error I am getting is incompatible types in assignment. If anyone can explain my error to me because I can't find it I would be very greatful.
I *'ed the lines that were popping up as errors
Thanks
Code:
//struct to hold information from file
typedef struct{
int id;
char name[50];
int age;
}record_t;
the function
Code:
//inserts items into array of structs
//Pre-Condition: fileptr points to a file and table
//is an empty array
//Post-Condition: table has element added as long as
//table is already full
void inserttable(int id, char name[50], int age, int firstloc,
record_t table[41])
{
int index;
index = firstloc;
if (table[index].id == -1){
table[index].id = id;
table[index].name = name;*
table[index].age = (int)age;
}else{
index = (index+1)%41;
while(index != firstloc || table[index].id != -1){
index = (index+1)%41;
}
if (index == firstloc){
printf("Unable to add item array full.\n\n");
}else{
table[index].id = id;
table[index].name = name;*
table[index].age = (int)age;
}
}
}