You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$10
For Premium members:
In this article I am going to walk through writing a C program in Visual Studio 2010.
Today I was recalling the good days of the C language and became tempted to play around with POINTERS, STRUCTURES, and DATA STRUCTURES etc. I started to write some C code and as soon as I started, the first hurdle came of where to write the code. I was running on 64 bit Windows 7 machine with Visual Studio 2010. I binged and found many suggestions to download this and install that etc. However being a fan and loyal user of Visual Studio, I was more desired to use the rich IDE of Visual Studio for my C program. To my surprise it is quite possible to use Visual Studio 2010 to write and compile code in C language. In this post I am going to walkthrough writing C program in Visual Studio 2010. Follow the steps as below,
See the image below, From the dialog box click on the Next button:The next screen is of Application Setting. You need to make sure that:
After clicking Finish you will find a project that has been created with the following structure. Open the Solution Explorer to see the structure.
To start programming, right-click on the Source Files and add a new item. You need to make sure of the following two points:
Now open Sample1.c and write a hello world program as below, Sample1.c#include<stdio.h>#include<conio.h>void main(){ printf("hello C from Visual Stido 2010"); getch();}To compile and run the program, simply press F5 and you should get output in the console window as below:You can see that CSample2.exe is running and this is name of the project. Next let us go ahead and write some code to print the address of a variable using Pointer.Sample1.c#include<stdio.h>#include<conio.h>void main(){ int number1=9; int *ptrNumber1; printf("hello C from Visual Stido 2010\n"); ptrNumber1= &number1; printf("%d\n",number1); printf("%d\n",*ptrNumber1); printf("%d\n",ptrNumber1); printf("%d\n",&number1); getch();}The code above is quiet simple:
In this way you can work with C language programs in Visual Studio. I have yet to explore how to execute data structures programs like Stack, Link List etc. in Visual Studio. Allow me to explore that and expect further articles on that. I hope this post is useful. Thanks for reading.
Pro WPF: Windows Presentation Foundation in .NET 3.0