Dato che ti serve leggere un solo carattere, valuta la possibilità di evitare l'uso di una stringa, e della variabile di stato per uscire dal ciclo.
codice:int main() { STUDENTE* studenti; studenti = (STUDENTE*)malloc(MAX_STUD * sizeof(STUDENTE)); if(studenti == NULL) { printf("Errore di allocazione!\n\n"); getchar(); return -1; } do { system("cls"); printf("SEGRETERIA STUDENTI\n\n\n"); printf("Scegli un'operazione selezionando il codice\n(Premere 'Q' per terminare)\n\n\n"); printf("A -> inserisci studente \nB -> fuori corso \nC -> cerca studente\n"); printf("D -> cancella studente \nE -> archivio studenti \nF -> esame non dato\n\nSelezione: "); switch( toupper( getchar() ) ) { case 'A': inserisciStudente(studenti); break; case 'B': fuoriCorso(studenti); break; case 'C': cercaStudente(studenti); break; case 'D': cancellaStudente(studenti); break; case 'E': stampaArchivio(studenti); break; case 'F': noEsame(studenti); break; case 'Q': free(studenti); return 0; } } while(1); }