Sunday 9 May 2021

How to create and run C program in Linux and Unix

 


Creating C Program in Linux Terminal


Step 1 :


Create a file like First.c


Open the the file and write the souce code in the file.


#include<stdio.h>


int main()

{

printf("\nHello India Delhi\n\n");

return 0;

}




Step 2 :


In Terminal


1.

 

Compile the program


gcc First.c -o First


-o First tells the compiler to create an executable with the name First


2.


Run the program


./First 


output:


Hello India Delhi

No comments:

Post a Comment