I am trying to write a function with the same name, but that accepts 3 different typers of structs.I don't know how I can write the parameters to do this.So in the _______, there should be proffesore, amminustratore, studente. Sp that the function can accept all 3 types of struct but only one at the time. Here is the code:
int confermaCredenziali(struct ______ dati, char *uN, char *pW);
struct amministratore{
char userName[MAX_LNG];
char passWord[MAX_LNG];
int stato;
struct ammin *next;
};
struct professore{
int ID;
char userName[MAX_LNG];
char passWord[MAX_LNG];
int stato;
struct prof *next;
};
struct studente{
int ID;
char *userName[MAX_LNG];
char *passWord[MAX_LNG];
int punti;
int stato;
struct studente *next;
};
int confermaCredenziali(struct ______ dati, char *uN, char *pW){
while (dati != NULL) {
if (strcmp(dati->userName, uN) == 0 && strcmp(dati->passWord, pW) == 0){
if (dati->stato == 1)
return 1;
else{
printf("Il suo stato e' passivo.\n");
return 0;
}
}
dati = dati->next;
}
printf("Credeziali errate.\n");
return 0;
}