Mail your problems to us on lawania@lavania.in, we will solve it and put the solution here at Lawania.com

Writing Your First C Program in Linux, Compiling it with CC, and Running it Linux

Today we will learn how to write your First C Program in Linux, Compiling it with CC, and Running it Linux

Step 1 : Open terminal 

Press Ctrl + Alt + T



 Step 2 : start vi editor

type this command in terminal

vi


Step 3 : Activate Insert mode

Press Insert key on keyboard or i


Step 4 : Type your program


Step 5 : Now save your program

type Press ESC then : then w


Step 6 : Now type the file name

hello.c press Enter

your program is saved now on disk.


Step 7 : Now exit from vi

press ESC then : then q


Step 8 : Now compile and link your program

type cc hello.c press enter

now you have a file a.out to run, if you want to give different name to output file

type cc -o hello hello.c press enter


Step 9 : Now execute ( run) your program

type ./a.out or ./hello according to the compiler option you used.

now you have done





























now you have done

Still confused

Watch this video 

 




Share on Google Plus

About Lawania Krishan Kant Lavania

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.