How to compile the C program




Linux

1.Open terminal

Use the vim editor

Open file using,

2.vim file.c (file name can be anything but it should end with dot c extension) command.

To Edit the file:

3.Press i to go to insert mode.

Type your program.

4.To save the file:

Press Esc button and then type :wq. It will save the file.

To compile the program:

Type,

5.gcc file.c

To Run the program:

Type,

6. ./a.out





Windows

Download the latest Dev CPP compiler from the trusted website. Install it. Its GUI based compiler, it will be easy to use.

In file tab click new

Dev CPP new file

Type your program

Save it wherever you want

In Execute tab,

click compile

and then click run

or straight away click compile and run button.

Dev CPP compile and run

Topics You Might Like