Chapter 7. Compiling & Running Programs

Table of Contents

The C Language
The C++ Language
The Java Language

The C Language

Create a file with .c as suffix, e.g., mine.c and place in it the following C program.

/* this is a comment */
#include <stdio.h>    /* bring in I/O library */
main ( )
   {
     int i;
     i = 8;
     i = i + 1;
     printf("This is a C program. %d\n", i);
   }

To compile and link using GNU's C compiler, type:

 hostname{~}% gcc mine.c -o mine

To run:

 hostname{~}% mine