I am having the above mentioned compile error. The line of code is this:
if ((strcmp(tempDept, data[1].Dept)==0) && tempCourse == data[i].course){
if (tempDay = data[i].meet_days &&
tempTime == data[i].start.hour){ //<---This line
printf("this worked");
}
}
Here is my structs declarations:
typedef enum {MW, TR} days;
typedef struct {
int hour, min;
} Time;
typedef struct {
char Dept[5];
int course, sect;
days meet_days;
Time start, end;
char instr[20];
} sched_record;
And here is my list off variables:
int switchInput;
int i = 0;
int tempCourse = 0;
char tempDept[5];
char tempDay[2];
int tempTime;
//char tempTime[1];
FILE *filePointer;
sched_record data[MAX_RECORD];
Can someone tell me how to fix this?
This couses a problem because
tempDayis char array of length 2 andmeet_daysis enumdays. And in C constants in enums are just ofinttype. Another problem that you can’t assigninttochar arrayitself. Maybe you wanted an equal sign==?Now you must think how to convert
intenum value tochar[2]. One way is usesprintf()to accomplish that. But concrete implementation depends on your interpretation of enum constants.