From d3262419a85c991e665d17c5233522bf542bdba4 Mon Sep 17 00:00:00 2001 From: Reina Harrington-Affine Date: Thu, 14 Aug 2025 17:42:15 +0000 Subject: [PATCH] Added comments to explain certain code behaviors in ex1_10.c so that they can be read and referred to later more easily. Future code should be properly annotated on initial commit. --- KNR C/ex1_10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/KNR C/ex1_10.c b/KNR C/ex1_10.c index 18d39d9..941bfc4 100644 --- a/KNR C/ex1_10.c +++ b/KNR C/ex1_10.c @@ -1,13 +1,13 @@ #include int main(){ -int a = 0; +int a = 0; /*Initializing a as zero; this doesn't matter because getchar is called at the top of the loop */ while (a != EOF){ a = getchar(); - if (a == '\b' || a == '\t' || a == '\\'){ + if (a == '\b' || a == '\t' || a == '\\'){ /*Test whether the currently selected character is a tab, backspace, or backslash */ if (a == '\b'){ printf("\\b"); continue; @@ -15,7 +15,7 @@ int a = 0; if (a == '\t'){ printf("\\t"); continue; - } else { + } else { /*There are only three possible cases here, and by the time we get here, we've tested two, hence an else statement is more efficient than doing another entire if statement*/ printf("\\\\"); continue; }