Sunday, August 16, 2009

How C works ...

lets see how can we give instructions to computer....
simple answer write a program in any language and run that wid appropriate s/w n h/w...

i am currently into C n C++ ... i will start with these 2 technologies...

again we are dealing with computer d dumb guy ... he
(it) understands only single language d binary language ... d language with 2 symbols 0 and 1 ...

so if u want to say something like 14 we have to say like 1110 i.e. (14)10 = (1110)2
again we pad the zeros in front of this binary number ...

comp understands 0,1 but we understand English ...
so we write our instructions in English because writing 14 as (some oooooo1110)2 is tedious thing


so we write it in C language ...
i am expecting that u all know C syntax ... n will not go into syntax details ...
rather i am interested in some basics ...

we write instructions with symbols such as lets say
some keywords like int , char , float
some variable names ia, ib and so on...

for e.x.

#inlcude "stdio.h"

int main ()
{

printf("hi i hope u are with me");
return 0;
}

this is simple program .i.e. set of instructions ... for our dumb guy ...
but our dumb guy comp understands binary so there has to be someone who translate our symbol for computer ...

n d one who do this is called compiler ... yes u r absolutely right... its compiler

we put it in pic,,, 1 guy lets say Dude knows Hindi (Hindi is India's national language)as well as English ....


but person from remote place of India only knows Hindi if he wants to tell something to NRI person who knows English ..

so flow goes like dis
point to be noted compiler is program converting C program to some other form more specifically .obj files


so we write our program in .c files say a.c and after compilation we get 1.obj file ...
See then we do some linking n loading and we get .exe file i.e. executable file...


lets see in detail...


hmm looks cool n easy ,,, lets add some more complexity ...

1 comment: