To make the world right again, you have to fix the program. This process requires editing the source code file, making the needed correction, saving the source code file back to disk, and then recompiling.
You can fix the ERROR.C program by adding a semicolon. Edit Line 5 and add a semicolon to the end of the line. Also correct the sentence displayed on the screen so that it reads as follows:
printf(“This program will no longer err.\n”);
Other than changing Line 5, everything else in the program remains untouched.
Save ERROR.C back to disk. Recompile the program and then run it:
This program will no longer err.
Indeed, it does not!
I can’t always tell you where to fix your programs. ERROR.C is the only program listed in this book that contains an on-purpose error. When you get an error message, you should check it to see where the error is in your source code. Then cross-check your source code with what’s listed in this book. That way, you find what’s wrong. But when you venture out on your own and experiment, you have only the error message to go by when you’re hunting down your own errors.
Pull two Rs out of ERRORS and you have Eros, the Greek god of love. The Roman god of love was Cupid. Replace the C in Cupid with St and you have Stupid. Stupid errors — how lovely!
See also:
No comments:
Post a Comment