Sunday, December 26, 2010

Compiling C Program Under Unix

To compile the C program under Unix environment. We need C Compiler to compile C program. Some C compilers are cc, gcc and etc., In this cc compiler is available under any environment. To compile:
cc file_name.c
this will compile C program. To run,
./a.out

Example:
cc sample.c

To run this,
./a.out

Another way,
cc -o output_file file_name.c

To run this,
./output_file

Example:
cc -o sampleout sample.c

To run,
./sampleout

No comments:

Post a Comment