To Compile C Language Program in Linux/Ubuntu as first open
terminal in Linux. For that, goto Applications – Accessories –
Terminal
Then, type in Terminal- gedit Filename.c
For example- gedit Clanguage.c
Then, press enter key from your keyboard. After this, a Simple Text Editor will open as named Clanguage.c as illustrated in figure —>
In text editor then, write your c Language code. Visit figure-
Then, click on save button to save your c language file. Save it where you want.
And then, close your text editor as you will back to terminal.
Then, type in Terminal following commands to execute your c language program (code) which is in file named Clanguage.c.
Type-
gcc -c language.c (to type this command you will get ouput file of Clanguage.c file)
gcc Clanguage.c -o Clanguage (to type this command you will get an executable file)
Finally type-
./Clanguage
Visit figure for best help—