C has been the de facto standard for system programming for more than 2 decades. While some of its features (like dynamic memory allocation, structures etc.) have made it increasingly attractive for the implementation of scientific codes, the lack of built-in complex arithmetic (unlike Fortran), the absence of an established standard complex arithmetic library, the fact that in most cases the simplicity of Fortran makes the job of optimizing compilers easier (and hence a Fortran code is more likely than not to be faster than its C equivalent) and the huge volume of Fortran-based scientific library subroutines make a lot of scientists & engineers program in mixed mode: partly C (mostly the basic structure of the code, including memory allocation) and partly Fortran (for the compute intensive parts).
% cc c_program.c -o executable_nameIf you omit -o executable_name the executable binary will be called a.out by default.
% cc c_program1.c c_program2.c -o executable_nameor compile them separately and then link the resulting object files (".o" files) together:
% cc -c c_program1.c % cc -c c_program2.c % cc c_program1.o c_program2.o -o executable_nameIf some of the include files that you require (by # include <include_file.h> statements in your C source code) are not in the standard include file search paths the C preprocessor cpp (called by the C compiler automatically) searches in, you can specify them by the -Iinclude_search_path flag:
% cc -I/usr/local/mpich/include -c mpi.cSimilarly, if some of the librariy functions that your program uses are not to be found among the standard libraries the linker looks in for a C program, you have to specify them yourself, sometimes including the path to the library if it not in the standard directory the linker looks in:
% cc mathc_program1.o mathc_program2.o -o executable_name -lm % cc mpi.o -o mpi-test -L/usr/local/mpich/lib/IRIX/ch_shmem -lmpi -lmIf you are using a library whose filename is libblas.a, you specify it as -lblas.