Here is a new program, ERROR.C. Note the optimism in its name. It’s a flawed C program, one that contains an error (albeit an on-purpose error):
#include <stdio.h>
int main()
{
printf(“This program will err.\n”)
return(0);
}
Type the source code exactly as it appears here. Do not use the GOODBYE.C source code as a base; start over here with a clean editor window.
When you’re done entering the source code, save it to disk as ERROR.C. Compile it, and then. . . .
Unfortunately, when you compile this program, it produces an error. The next section provides the autopsy.
Pay careful attention as you type! Each little oddball character and nutty parenthesis is important to the C language!
Here’s a hint on the common GCC command to compile this source code: gcc error.c -o error
That’s the last compiling hint you get in this book!
No comments:
Post a Comment