Do you wish to know howto write, compile and execute C Program in Linux platform? Then you are at right place.In this tutorial I will show you howto code and run C Program in Linux terminal. 🙂
1. Goto Linux Terminal.
2. Type Vi Filename.C
In the above screenshot I have given filename as 2038bug.c
3. The Vi Editor will open.
To know more about commands used in VI editor checkout,
Vim/Vi Editor Commands Cheat Sheet
4. Press I to insert text and start writing the C Program into it.
5. After coding it.Just press Esc button and type :wq
Here :wq specifies save and exit.
How to Compile C Program In Linux Terminal ?
6. The next step after coding is compilation part.To compile C Program type the following in Terminal,
If you had any error again enter into text editor,
Vi Filename.c after fixing the error press :wq (Save and exit).
7. Now execute the program to see the Output
The output of the program will be displayed. 😉
1000000000, Sun Sep 9 01:46:40 20012147483647,
Tue Jan 19 03:14:07 2038-2147483648,
Fri Dec 13 20:45:52 1901