int i=0; printf("Inserisci la password: "); do { c = _getch(); switch(c) { case '\b': if (i>0) { i--; printf("\b \b"); } break; case '\r': break; default: pass[i] = c; i++; printf("*"); } } while( c != '\r'); pass[i]=0;