Annotation updates.
This commit is contained in:
parent
2638922bbe
commit
b466a300d0
1 changed files with 7 additions and 6 deletions
|
|
@ -5,19 +5,20 @@
|
||||||
|
|
||||||
int main(){
|
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*/
|
if (a == EOF){ /*Check whether first character is EOF*/
|
||||||
printf ("No data to parse.");
|
printf ("Error: No data to parse. \n Exiting.");
|
||||||
EXIT_FAILURE;
|
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' || a == '\b' || a == '\\'){
|
||||||
if (a == '\t')
|
if (a == '\t')
|
||||||
printf("\\t");
|
printf("\\t");
|
||||||
if (a == '\b')
|
if (a == '\b'){
|
||||||
printf("\\b");
|
printf("\\b");
|
||||||
|
}
|
||||||
if (a == '\\')
|
if (a == '\\')
|
||||||
printf ("\\\\");
|
printf ("\\\\");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -26,7 +27,7 @@ loop_start:
|
||||||
|
|
||||||
a = getchar();
|
a = getchar();
|
||||||
|
|
||||||
if (a != EOF)
|
if (a != EOF) /*Only trigger next loop if 'a' contains valid data.*/
|
||||||
goto loop_start;
|
goto loop_start;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue