From b466a300d00956c786e6404d4616bc698fd62adb Mon Sep 17 00:00:00 2001 From: Reina Harrington-Affine Date: Thu, 14 Aug 2025 22:05:46 +0000 Subject: [PATCH] Annotation updates. --- KNR C/ex1_10_goto.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/KNR C/ex1_10_goto.c b/KNR C/ex1_10_goto.c index 8a2d38e..7bbffc5 100644 --- a/KNR C/ex1_10_goto.c +++ b/KNR C/ex1_10_goto.c @@ -5,19 +5,20 @@ int main(){ - int a = getchar(); + int a = getchar(); /*There is, unfortuately, no immediately obvious way to avoid repeating this since we need to initialize 'a' in order to have valid data for everything beyond this line*/ if (a == EOF){ /*Check whether first character is EOF*/ - printf ("No data to parse."); - EXIT_FAILURE; + printf ("Error: No data to parse. \n Exiting."); + EXIT_FAILURE; /*Exit if there is no data to parse.*/ } -loop_start: +loop_start: /*Goto will circle back to the next line if a != EOF*/ if (a == '\t' || a == '\b' || a == '\\'){ if (a == '\t') printf("\\t"); - if (a == '\b') + if (a == '\b'){ printf("\\b"); + } if (a == '\\') printf ("\\\\"); } else { @@ -26,7 +27,7 @@ loop_start: a = getchar(); - if (a != EOF) + if (a != EOF) /*Only trigger next loop if 'a' contains valid data.*/ goto loop_start;