Thursday, 19 September 2013

Simple C Program In Ubantu

Step 1:
Open Terminal
Write Command "gedit" to open editor

Step 2:
Write C Program In editor
for eg:

#include<stdio.h>

void main()
{
    printf("Hello Bharat");
   
}


Save the Program "bharat.c"

Step 3:
Open The terminal
CD command for change directory
 cd Desktop
(For example you save the program in Desktop then use cd Desktop)

Step 4
First compile the program using command
gcc bharat.c -o  bharat

if you use only gcc bharat.c then create a.out file
-o file name is the output file

Step 5:
Run The Program using command
"./outputfile name"

./bharat

Step 6:
Output show in terminal
Hello Bharat

No comments:

Post a Comment