Friday, June 22, 2012

Let's program C in windows

How to program C while  in windows platform. 

There are few ways i used to do C programming, these are not the only ways , so please give a feedback if u know any other way to do C while in windows platform.

Microsoft Visual Studio.
Turbo C
Using desktop virtualization software , install UNIX.

Microsoft Visual Studio.


This is a powerful IDE ( Integrated Development Environment) which gives tools to do C , C++ , C#
.NET Frame work managed windows applications.
This is not a opensource software so we have to buy it  , but i heard some higher educational institutes and universities offers student license for this software.

You can download free trial version of Visual Studio from following links.


To edit simple C program using Visual  Studio use following steps.


From the main menu select File -> New -> Project in the project new window
Under Project types, select Win32 - Win32 Console Application
Name your project, and specify a location for your project directory
Click 'OK', then 'next'

In the Application Wizard:
Select Console application
Select Empty project
Deselect Precompiled header
Once the project has been created, in the window on the left hand side you should see three folders:
Header Files
Resource Files
Source Files
Right-click on Source Files and Select Add-> New Item
Select Code, and give the file a name
The default here will be a file with a *.cpp extension (for a C++ file). After creating the file, save it as a *.c file

To compile the program 


Press the green play button.
By default, you will be running in debug mode and it will run your code and bring up the command window.
To prevent the command window from closing as soon as the program finishes execution, add the following line to the end of your main function: 
getchar();
This library function waits for any input key, and will therefore keep your console window open until a key is pressed.

Turbo C


Turbo C, version 1.0, was introduced by Borland in 1987. It offered the first integrated edit-compile-run development environment for C on IBM PCs. It ran in 384KB of memory. It allowed inline assembly, supported all memory models, and offered optimisations for speed, size, constant folding, and jump elimination.

Version 1.5 shipped on five 360 KB diskettes of uncompressed files, and came with sample C programs, including a stripped down spreadsheet called mcalc.


Turbo C 2.0 has a debugger, a fast assembler, and an extensive graphics  library.  

Turbo C has been largely supplanted by Turbo C++, introduced circa September, 1990 for both MS-DOS and Microsoft Windows.

Here is a video tutorial which describes how to use Turbo C for C Programming.



Desktop Virtualization Software

These  soft wares helps to run multiple Operating systems on the windows platform then its help us to work in UNIX while in Windows Platform. These soft  wares actually work like physical computers. They share hardware resources of the physical machine and enable to run OS smoothly.  

There are lot of Virtualization soft wares , I have chosen some of them here..


Virtual Box

Owned by Oracle, but freely available as Open Source Software, is a powerful x86 and AMD64/Intel64 virtualization tool, wholly compatible with Windows, Linux, Macintosh, and Solaris hosts and supports a large number of guest operating system. 


Download Virtual Box Free here





VMware Player


VMware Player is also one the powerful virtualization tool. VMware Player supports Windows, Linux which lets you run multiple guest operating systems simultaneously in separate windows. But you need to register  in order to download and use this tool




I have use both of these softwares  and i think virtual box is works much more smoothly and also it doesn't allocate the system resourses permanently (like hard disk space etc.) .

I f  you use more efficient or different Virtualization software please exchange your experience with us.


So we can install UNIX Operating System to one of this virtual machine and do our C programming using it's terminal window. UNIX environment included the CC compiler , so you can just write the program and run it easily.


















No comments:

Post a Comment