From 79c639faa5babc2772362413739c14351976461f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Wed, 25 Nov 2020 09:14:23 +0100 Subject: [PATCH] fix errors 1 --- Commissions/flis/IMT/Case3/case3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Commissions/flis/IMT/Case3/case3.c b/Commissions/flis/IMT/Case3/case3.c index 91c94b1..7445ed9 100644 --- a/Commissions/flis/IMT/Case3/case3.c +++ b/Commissions/flis/IMT/Case3/case3.c @@ -48,7 +48,7 @@ int main(void) { int len_number = strlen(number); for (int j = 0; j < len_number; j++) { // loop over chars in the phone number int index = number[j] - '0'; // Go to the node we're testing - if (pointer->children[index == NULL]) { + if (pointer->children[index] == NULL) { pointer->children[index] = newNode(); }; pointer = pointer->children[index]; @@ -69,7 +69,7 @@ int main(void) { printf("FOUND PREFIX IN NUMBER\n"); printf("%s and %s", number, number); while (pointer->isEnd != true) { // follow the first path you can find - for (int k = 0; k < 10; k++) { + for (int k = 0; k < 10; k++) { if( pointer->children[k] != NULL) { pointer = pointer->children[k]; printf("%c", k + '0'); // Print the path as we go @@ -83,7 +83,7 @@ int main(void) { }; pointer->isEnd = true; }; - else if (pointer->isEnd == true) { // if we've already seen a shorter number with this prefix + if (pointer->isEnd == true) { // if we've already seen a shorter number with this prefix printf("Found prefix!\n"); for (int k = 0; k < j; k++) { printf("%c", number[k]);