C Lesson 2: How to compile and run C program?
How to compile and run C program?
We have seen the detailed intro of C Language: History, Development, Advantages, disadvantages of the C Program in our previous post.
Now lets start learning C Language through series of basic concepts with respective example programs.
Before learning C, lets see the steps to install C software and running the First C Program.
Steps to Download and Install C Software:
- Check for previous installation of TurboC++ in your system.(check in control panel of the system).
- If it is already installed, uninstall that TurboC++.
- Now Download the TurboC++ from the link
- Extract and save the downloaded file in C drive (or other drive as like your convenient. But you should know where the software is saved).
- Now run the Setup.exe file from the downloaded folder. Then follow the instructions to complete the installation.
- Finally the process of downloading and installing TurboC++ is completed.
Lets see how to compile and run our First sample C Program.
How to Compile and Run C Program?
- Once the installation is completed, you can find its shortcut icon on the desktop. If so, then double-click that icon. Otherwise, go to the drive where you saved the software.
Click “TURBOC++ -> TC”.
- The Screen will open where you can type your program.
- See the following sample program and type that on the screen.
- Now save the program as “ProgramName.C”.
- The C is the extension indicating the your program is in “C” language.
- This is because, the same software supports the C++ language too. Hence specified as “.C”.
- To save, go to “File->Save us” option in the top menu bar.
Sample C Program : “HelloWorld.c “
<span style="color: #000000;">#include <stdio.h>
printf("MY FIRST SAMPLE PROGRAM "HELLO WORLD.C"\n");
This is our first sample C Program saved as “HelloWorld.C”. We shall see in detail about this program later.
Before that let’s try to compile and run this program.
To Compile and Run C Program:
- Click the compile option at the top menu bar. You can also use the shortcut key: “Alt+F9”.
- If bugs shown, clear it on the program screen and again save and compile the program.
- If no bugs shown, run the program by clicking the “Run” option shown in the same top menu bar.
Finally, we have create, compile,and run our first C program “HelloWorld.C”. The output screen shot will be as shown below….
Thanks for reading.. Please leave your comments below.. We shall see in detail about the program basics in our further posts….