Tuesday, January 25, 2011

What to do when you come across an error?

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. Com­pile 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!

Welcome to reproduce this passage. Please indicate the source when you reproduce this passage.
Source: C Language 
Partner:Best DVD Ripper to convert DVD to mp3

No comments:

Post a Comment