When the greeting()
function finishes, control is returned to main(), which prints out ???Bye??? and the name
given. Finally, the program exits.
Compiling with gcc
Compiling is the process of turning human-readable source code into machine-readable
binary files that can be digested by the computer and executed. More specifically, a
compiler takes source code and translates it into an intermediate set of files called object
code. These files are nearly ready to execute but may contain unresolved references to
symbols and functions not included in the original source code file. These symbols and
references are resolved through a process called linking, as each object file is linked
together into an executable binary file. We have simplified the process for you here.
When programming with C on Unix systems, the compiler of choice is GNU C Compiler
(gcc). gcc offers plenty of options when compiling. The most commonly used flags
are shown in Table 6-3.
For example, to compile our meet.c program, you would type
$gcc -o meet meet.c
Then to execute the new program, you would type
$./meet Mr Haxor
Hello Mr Haxor
Bye Mr Haxor
$
??“o
The compiled binary is saved with this name. The default
is to save the output as a.
Pages:
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283