Compile and Run C Programs using VS2008
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.
Code:
#includevoid main(){ printf(“First C Program”); getch(); }
Step 4: Go to the directory (Folder in which you have saved your C Program) from the command prompt.
Tips:
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.
Excellent article. Explained each and every steps very accurately. I will definitely refer this site to my friends who are new to C programming. This is the best C tutorial site i ever came across. Thanks for creating such a wonderful website.
very helpful….thanks……..
nice , thank you
best of best….:)
thanks a ton…..
Excellent article. I was really fed with compiling a c program until I found this. Thanks a lot.
super article. Can i know how to run collection of c files at a time. i.e. my folder have so many .c files?
excellent article mate.Thanks a lot.i need java tutorials also with this kind of explanation.Is there any site then pls provide a link.Thank u very muck……
Till date i have confused myself with c concepts, but after read your blog i would get a clear.hats off to you.
Thank you. 🙂
How do u write a sentence and count its characters? in c program
thanks
I am saving c programs in D with in one folder. how i can run that c file from that particular folder. Is it possible
I saved the C file in D drive within a folder. How i can run from that place itself?
Is it possible
how can I compile c code with header file and run it
nice post. Thank you.
very nice…
very helpfull…