C Programming Tutorial Part-1  

Posted by Kunal Pradhan

you know when we r talking about a new program we must know the keywords of that program, by using which we construct the program these keywords are defined in compiler, so here is the list of keywords used in C,

there are 32 keywords defined in standard C, and these are :=


auto double int struct break else long switch case enum register

typedef char extern return union const float short unsigned continue

for signed void default goto sizeof volatile do if static while

Now we will learn more about these keywords,

Data Types

there are five datatypes in C subset : character ( like A,B,c,d); integer(12,50,89675); floating point (12.564,0.9876); double floating point (12.7865234195) - the precision is more than simple floating point and value-less


the keywords for them are respectively char,int,float,double and void



now we have a very long list of the range of these keywords

i am giving just fews :-

the size of char type variable in memory is 1 byte and it's range :- -127 to 127
and the keywords signed and unsigned is used to define explicitly if negative sign will be present there or some other ways will be taken to represent the negative variable :- like - unsigned char ranges from 0 to 255


size of int type variable in the memory is 2 byte and ranges from -32767 to 32767 (if we dont tell the comiler explicitly then it takes it as signed i.e. with negative signs) and the size of float is 4 byte whereas the size of double is 8 byte

i am sure with lots of theory ur head is just buzzing now so we here give an example, how ur first c program should be



#include<>

void main()
{
printf("Hello world");
}


this will print Hello world in the output screen


now we analyse the program

at first line i have given #include<>

i am not gonna tell you guys what exactly this thing means right now, you will learn more when i start pre processor

for present information include is a pre processors directive and every pre processors must start with a '#' and that means we r including some files here, and in this case the file is stdio.h... the extension .h stands for header file

and stdio (standard input-output) is a special file stored in compiler which has some compiler defined functions which are related to input and output, we will learn about them later

Read all C Programming tutorials Click here

This entry was posted on Wednesday, June 18, 2008 and is filed under , . You can leave a response and follow any responses to this entry through the Subscribe to: Post Comments (Atom) .

0 comments