NOTE: CentOS Enterprise Linux is built from the Red Hat Enterprise Linux source code. Other than logo and name changes CentOS Enterprise Linux is compatible with the equivalent Red Hat version. This document applies equally to both Red Hat and CentOS Enterprise Linux.
To start, create the following sample source code file and save it as
hello.c.
The following sections show you how to compile
this file to form an executable and how to run it.
#include <stdio.h>
int a, c;
static void
foo (int b)
{
c = a + b;
printf ("%d + %d = %d\n", a, b, c);
}
int
main (void)
{
int b;
a = 3;
b = 4;
printf ("Hello, world!\n");
foo (b);
return 0;
}