fixed infinite loop on incalid input
This commit is contained in:
		
							parent
							
								
									87c5fa8225
								
							
						
					
					
						commit
						7dfcf1500b
					
				
							
								
								
									
										8
									
								
								src/ui.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								src/ui.c
									
									
									
									
									
								
							| @ -33,10 +33,13 @@ int main(void) { | ||||
|     printf(" -5- Faecher Importieren\n"); | ||||
|     printf(" -6- Planer beenden\n"); | ||||
|     printf(" Wähle die gewünschte Option aus\n"); | ||||
|     if (scanf("%d", &choice) != 1) { | ||||
|     volatile int r = scanf("%d", &choice); | ||||
|     if (r != 1) { | ||||
|       printf("Falsche Eingabe\n"); | ||||
|       fgetc(stdin); | ||||
|       choice = 0; | ||||
|       continue; | ||||
|     }; | ||||
|     // choice = 0;
 | ||||
| 
 | ||||
|     switch (choice) { | ||||
|     case 1: | ||||
| @ -95,6 +98,7 @@ int main(void) { | ||||
|     case 3: | ||||
|       if (listT == NULL) { | ||||
|         printf("Die Liste ist leer"); | ||||
|         break; | ||||
|       } else { | ||||
|         llistPrintT(listT); | ||||
|         //   llist *iterator = list;
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 ketrptr
						ketrptr