How to run c program in ubuntu?


 To run c program in ubuntu open a new terminal (CTRL+ALT+T) and navigate through the folder where the code exists using (cd Foldername).

Use the command gcc to execute c code.

  1) gcc filename.c 
  2) ./a.out

or

  1) gcc filename.c -o filename1
 2)  ./filename1


If gcc is not installed in your system using the following command to install the compiler and related packages

            sudo apt-get install build-essential