My function searchlist asks the user enter a student ID and lists that student ID and name. Here is my struct:
struct student {
int ID;
char name[40];
struct student *next;
};
typedef struct student Student;
Here is my function:
void searchlist(Student *SLIST){
Student *currentstudent = SLIST;
char str[10], str2[10];
printf("Enter a student ID: ");
while(currentstudent != NULL){
scanf("%d", &str);
if(strcmp(str, (char)currentstudent->ID) == 0){
printf("ID#: %d Name: %s", currentstudent->ID, currentstudent->name);
}
}
}
However, when I try compiling, it gives me a warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast