We can easily Run and Compile C programs on Ubuntu Linux.
just follow below steps to run a compile C Program.

Step 1 : Open UP a Terminal
Search for terminal application in dash tool or simply press ctrl+alt+t to open up a terminal.

We have to use a text editor to write a C Program.

Step 2 : Open text Editor 
To Open a text editor, just write the bellow code on the terminal.

gedit hello.c

hello is the file name, you can choose any file name and then put a ‘.c’ and hit enter.

 

(adsbygoogle = window.adsbygoogle || []).push({});

Step 3 : Write the Code
Now write the C program here, just like this.

 

and SAVE the code and close the editor window and return to terminal.

Step 4 : Compile the Code
To Compile the saved code, just type the below command on the terminal.

cc hello.c

or we can use –

gcc hello.c -o hello.out

here hello is the file name. If your code is right then it will end up with no errors.

Step 5 : Run / Execute the Program
To run the code just type the following code on the terminal.

./a.out

or we can use –

./hello.out

and you will find the result.

 

(adsbygoogle = window.adsbygoogle || []).push({});

 

Share This
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!