Browse Source

refactoring: nameAusgeben nullt --> nullterminante

main^2
Peter Wiebe 11 months ago
committed by Peter Wiebe
parent
commit
9b5afc9b75
  1. 6
      src/main/c/hangman.c

6
src/main/c/hangman.c

@ -117,7 +117,7 @@ void nameAusgeben(){
char name[50]; char name[50];
int i = 5; int i = 5;
int zaehler = 0; int zaehler = 0;
int nullt;
int nullterminante;
FILE *fp = NULL; FILE *fp = NULL;
fp = fopen("hangman.txt", "r"); fp = fopen("hangman.txt", "r");
@ -127,7 +127,7 @@ void nameAusgeben(){
zaehler++; zaehler++;
i++; i++;
} }
nullt = zaehler;
nullterminante = zaehler;
while(zaehler != 0){ while(zaehler != 0){
name[--zaehler] = KonfDatei[--i]; name[--zaehler] = KonfDatei[--i];
} }
@ -137,7 +137,7 @@ void nameAusgeben(){
i++; i++;
} }
name[nullt] = '\0';
name[nullterminante] = '\0';
printf("%s\n", name); printf("%s\n", name);
fclose(fp); fclose(fp);

Loading…
Cancel
Save