How to Compile and Run C Programs using Microsoft Visual Studio 2008? Here is the answer…
In this article I will explain you how to use Visual Studio 2008 to compile and run C program. Compiling and running C Program is as easy as we do in Tourbo C++. Below is the procedure. Please note that the same method applies to Visual Studio 2010 too. So what are waiting for. Read the below article and leave some feedback…
Step 1: Go to Start menu->All Programs->Microsoft Visual Studio 2008->Visual Studio Tools->Visual Studio 2008 Command Prompt
Following screen will be displayed:
Step 2: Create a text file with the name ‘FirstCProgram’ save it as ‘FirstCProgram.C’. Make sure that the extension is ‘.C’ and not ‘.txt’.
Step 3: Write your C program in ‘FirstCProgram.C’ or you can use the below code and save it.
printf(“First C Program”);
Step 4: Go to the directory (Folder in which you have saved your C Program) from the command prompt.
To go to one level back type ‘cd..’ and press ‘Enter’.
If you want to change the drive from ‘C:’ to ‘D:’ just type ‘D:’ and press ‘Enter’.
Let us suppose you want to go to folder named ‘Programs’ present in ‘D’ and you are in ‘C:’ drive then just type the commands in command prompt as shown in the below screenshot.
Step 5:Type the following command to compile your C Program as shown below.
Command: cl FirstCProgram.C
On successful compilation following screen will be displayed.
After successful compilation, you can see FirstCProgram.obj file and FirstCProgram.exe file in your folder. You can ignore FirstCProgram.obj file as it is intermediate file. You can safely delete it if you don’t want that file to be in your computer.
Step 6: To run the program simply type FirstCProgram in your command prompt and press enter or you can directly click the.exe file that got created just after compilation.
Thats all folks. I will come up with a new article in another few days. Please provide your valuable comments about this article or anything related to this website. It would really help me in improving the website.