20.09.2015 Views

Programming in C

Kochan - ProgramminginC

Kochan - ProgramminginC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8 Chapter 2 Some Fundamentals<br />

dur<strong>in</strong>g this phase, they are reported to the user and the compilation process ends right<br />

there.The errors then have to be corrected <strong>in</strong> the source program (with the use of an<br />

editor), and the compilation process must be restarted.Typical errors reported dur<strong>in</strong>g this<br />

phase of compilation might be due to an expression that has unbalanced parentheses<br />

(syntactic error), or due to the use of a variable that is not “def<strong>in</strong>ed” (semantic error).<br />

Start<br />

UNIX Command<br />

Edit<br />

Source<br />

program<br />

(file.c)<br />

vi file.c<br />

Compile<br />

(and assemble)<br />

cc file.c<br />

yes<br />

no<br />

Errors?<br />

Object<br />

program<br />

(file.o)<br />

L<strong>in</strong>k<br />

Libraries<br />

and<br />

other<br />

object<br />

programs<br />

Execute<br />

Executable<br />

object<br />

(a.out)<br />

a.out<br />

no<br />

Results OK?<br />

yes<br />

Done<br />

Figure 2.1<br />

Typical steps for enter<strong>in</strong>g, compil<strong>in</strong>g, and execut<strong>in</strong>g C programs<br />

from the command l<strong>in</strong>e.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!