Followers

Saturday, June 14, 2008

Let us see "C" language

In computer, A language is a way to communicate with computer. With a help of language we can tell a computer what and how to do through the programs….

A Program is a set of instructions, which can be executed and the desired results can be obtained……

Let us see something about C language. C is a robust language which can be used in writing complex programs, because it has some built in functions and operators.... Programs written in c are efficient and fast. Another important feature of C language is, the program written for one computer can be used in another without any modification...


The basic data type of c language is as follows...


Data Type

int float double char
%d %f %f, %g, %e %c




The range of these data types are as follows…..

1. Short int – -127 to 128
2. Signed int - -32767 to 32768
3. Long int - 231 – 1
4. Unsigned int – 0 to 65535


The basic structure of the C program will be like this………


#include
#define

main( )
{

Variable declarations;
Function prototype;
Program statements;

}


There are some basic rules for forming a variable.

1. First letter of the variable should be an alphabet or underscore
2. It can be a combination of alphabets, digits and underscore
3. It should not be a keyword ( like int, float etc.,)
4. It should be unique
5. The length of the keyword should be maximum 31 characters, if it exceeds 31, it will be discarded.

With the above said things we can write a small C program to add to numbers…


#includemain( )
{
int a, b, c; variable declaration.
a = 5;
b = 6; adding a and b
c = a+b;
printf (“c = %d”, c); printing the value of c
}


with the same example we can try some more programs on our own like subtraction, multiplication and division…

3 comments:

Unknown said...

Very informative!!!

Madurai citizen said...

Thank you

SARAVANA PRAKASH said...

Very, very valuable information to every graduates aspiring for jobs. C rules campus placements.