Tuesday, February 26, 2013

How To Run C Program in Linux

How To Run C Program in Linux

Its Very simple to compile and execute C Program in Linux Environment

Step 1: Create a New file

Open the Terminal and create new program in C  in Linux

To Create a new File in Linux For C Program

vi  filename.c

eg : vi firstcpgm.c
Then type a simple Program and press Esc and wq

Step 2: Compile C Program in Linux

To Compile  C program type the below command in Terminal

cc filename.c

Eg. cc firstcpgm.c

If u have any error in program it will display after execute the above program 
if u program was no error the run the program

Step 3: Run C Program in Linux

Finally clearing the error in program execute the below command to get the program output 

./a.out

That sol finally we got the output for the program

How To Run C Program in Linux

4 comments:

Linux Tips and tricks,Online Linux Helpers