Sunday, January 27, 2008

Hi,
I'm an IT engineering student. Here i have some easy points on c language & some part on data structure using C.
-------------------------------------------------------------------------------------
C language:-
This is based on windows platform.
To perform this pragram u have to install turbo c/c++.
Then in bin folder doubleclick on tc.
click on file and click new.
Then start typing the program.
Note that the instructions should be in either upper or lower case.
So first let me give u a simple program & then explamn the terms.
*************************************************************************************
#include
#include
void main()
{
printf("Hello world");
getch();
}

*************************************************************************************
include:-This means including the file from the include folder which contains the information of thf words in angular bracket.in any case this means the same.
#:-This is to differentiate the include files.
<>:-this is the way in which the include files are represented.
.h:-Extension of the header file.
stdio:-This means standard input & output.
conio:-This means common input output.
void:-This means there is no return type for main. Now it will be better to assume that this is a must component.the meaning of this will be understood onway.
main:-This is the main part which is compulsory in all the programmes.
{}:-The program is enclosed in the curly brackets.These are necessary.
printf:-This is the output instruction.
(""):-This is are the must after the instruction to differentiate the output from other instruction.
;:-This indicates the termination of the instruction.
getch():-This means get character.When in this program 'Hello world' is printed on the screen it will vanish immediately.So to stop this this instruction is used. This results the program to halt and wait until a character or any key is pressed to end execution.
-------------------------------------------------------------------------------------
Now u have understood what a c program is to some extent from the above program.
To compile the program press ALT+f9.This will show the errors if any.If any errors are shown then check and correct the errors.Then press CTRL+f9 to run the program.
-------------------------------------------------------------------------------------
Now we will do the further program which still harder than the previous one.
I will explain the newer instructions in the program.
*************************************************************************************
#include
#include
void main()
{
int x;
clrscr();
x=10;
printf("%d",x);
getch();
}
*************************************************************************************
int:-This stands for integer.
float:-this means also integers but having decimal point.
This means we are declaring a variable named x having type integer.
this means we are alloting or booking a space for an integer in the computer memory and giving it name x so that we can access that integer stored in the momory named x.
x=10;:-This means we are storing the value 10 in the memory location named x.

Watch tv!