From 207fe60c5b4b5d32b19f20fc302b00f7ea012b9c Mon Sep 17 00:00:00 2001 From: Reina Harrington-Affine Date: Fri, 22 Aug 2025 18:32:09 +0000 Subject: [PATCH] Per suggestions and feedback from Affine, removed a loop that initialized the charCount array, since modern C allows us better ways to do this. Saved 5 instructions in the binary :3 --- KNR C/ex1_13_improved.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/KNR C/ex1_13_improved.c b/KNR C/ex1_13_improved.c index 2d7668f..441f267 100644 --- a/KNR C/ex1_13_improved.c +++ b/KNR C/ex1_13_improved.c @@ -19,7 +19,7 @@ int main(){ - int charCount[11]; /*Array for storing char lengths*/ + int charCount[11] = { 0 }; /*Array for storing char lengths*/ int last, lCount, state, i; /*last stores last character, or 0 at init. lCount increments every time the main for @@ -27,12 +27,6 @@ int main(){ character and then resets when one is encountered after commiting its value to charCount.*/ - /*Begin array initialization*/ - for(i = 0; i < 11; ++i){ - charCount[i] = 0; - } - /*End array init*/ - last = lCount = 0;