You are on page 1of 1

Writing Your First C Program Under Linux / UNIX

Use a text editor such as vi or gedit to create a C program called first.c:


you can type termial vi first.c .page wiil be open. press i insert will be app
ear on that page . type or paste ur program as follows.

#include <stdio.h>
int main(void){
printf("My first C program\n");
return 0;
}
after program is over :wq(it is save and quit) enter.the terminal will appear.th
en as follows
To compile C program first.c,
gcc first.c
OR
cc first.c
To execute program first, enter:
./first
Output:
My first C program

You might also like