Wednesday, August 28, 2013

About this site

Well this site deals exclusively with the C Programming Language! Here we take you from the basics of C to the use of few of the most important libraries that we have mastered so far.

For the Basics we refer to "Computer Science - A Structured Programming Approach Using C" by Behrouz A. Forouzan & Richard F. Gilberg. 

So all set to start?

Firstly you will need a compiler (something to run your C code).
I use XCode 4.6.3 on Mac. You can use Visual Studio or Turbo C for Windows and gedit with cc compiler on Ubuntu or Linux.

First program


Let's traditionally stick to "Hello World" program but not actually type the same you know:)
Coz when I first started programming at the age of 6 I never felt like typing the same in BASIC.
So type whatever comes to your mind inside the angle braces < >.

/*My first program*/
/*Copyright (c) 2013 Kevin Prasanna. All rights reserved.*/
/*Include Header files*/
#include <stdio.h>

/*Main function*/
int main()
{
    printf("HEY COMPUTER PRINT MY NAME : KEVIN\n");
    return 1;
}


Everything within /*_ _ _*/ is a comment line. This is essential though it doesn't add up to any code.
It shows the owner of the code and stuff like that. You will know more of its uses when we take up a little longer programs:)

NOTE: If you are using Turbo C or Visual Studio you will have to add the header file called <conio.h>
as #include <conio.h>

This is how the code looks on XCode


This is how it should look in Visual Studio


Just the run the code by pressing the play buttons.
See your output.
Comment further if you need any help in setting up XCode or Visual Studio.
Do Comment and Subscribe if you like it! Stay Tuned!

No comments:

Post a Comment