How you can run a c program in Linux?

Posted on in Categories , , last updated October 16, 2007

Q. I’ve a c program and I’d like to run in Linux.

A. C program need to compile and run in Linux using cc or gcc command. When you invoke GCC (GNU C Compiler), it normally does preprocessing, compilation, assembly and linking for you. For example to compile hello.c program , type the following command:
cc -o hello hello.c
OR
gcc -o hello hello.c

It will compile and produced an exectuable file called hello. To run program type:
./hello