Kenwood HP 9000 Personal Computer User Manual


 
Chapter 2 37
What Happens When You Compile and Link a Program
Compiling Programs on HP-UX: An Example
sum += n; /* add n to sum */
return sum; /* return the value of sum */
}
main() /* begin main program */
{
int n; /* number to input from user */
printf("Enter a number: "); /* prompt for number */
scanf("%d", &n); /* read the number into n */
printf("Sum 1 to %d: %d\\n", n, sum_n(n)); /* display the sum */
}
Generally speaking, the compiler reads one or more source files, one of
which contains a main program, and outputs an executable a.out file,
as shown in “High-Level View of the Compiler”.
Figure 2-1 High-Level View of the Compiler