Wednesday 5 December 2018

Compile a C program in Ubuntu Linux

Step 1: press Alt + Ctrl + T to open a terminal

Step 2: create a directory with your name Ex. mkdir Sateesh

Step 3: to change the director type cd Sateesh

Step 4: to create a c file type gedit welcome.c
           now it will open the editor, type the following code.


#include<stdio.h>
void main()
{
  printf("welcome to c!");
}


Step 5: Save and close the file.

Step 6: Now to compile the c program, command is..
           cc welcome.c

Step 7: To run the c program command is ..
           ./a.out

Step 8: It will display welcome to C! as output.


No comments:

Post a Comment