I am trying to compare the input from the user to whether they entered something or not. If they did not, move onto the next input. I know I am missing something. I tried several ways of comparing:
strcmp, this =="NULL" this = "NULL", etc. What am I missing. Here is my code:
Code:
case 3:
fread(data, sizeof(sched_record), MAX_RECORD, filePointer);
fclose(filePointer);
printf("Enter Dept Name: ");
scanf("%s", tempDept);
printf("Enter Course Number of 0 for any course in department: ");
scanf("%d", &tempCourse);
printf("Enter Days of Class, M for MW, T for TTH or D for any: ");
scanf("%s", tempDay);
printf("Enter A for mornings, P for afternoons of D for any: ");
scanf("%s", tempTime);
for (i=0; i < MAX_RECORD; i++) {
if (tempDept == "NULL"){
if (strcmp(tempDept, data[i].Dept)==0) {
printf("\n%s", data[i].Dept);
}
}
else if (tempCourse != '0'){
if (tempCourse = data[i].course){
printf("\n%d", data[i].course);
}
}
}
break;