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 ...

Computer dumb guy

Hey hi... i have read somewhere blog must be interactive ... though m not a natural writer .. i ll try to keep my blogs as interactive as possible..i know person who knows me personally is going to read n appreciate my witting efforts... but i am more interested in unknown personalities ...
i want to know how they find my ideas ... helpful or total waste :P


my blogs will mostly contain technical topics ...but who knows i may change my field, my mind n i may move to some oder topics.. but as far now i think these will be 80 % technical...

Again as i have mentioned above i m not sure about my future plans...
the most unpredictable change is nature and as animals we humans are part of it... so we are unpredictable ... we have our own ideas.. our own vision n our decisions are mostly depend on these so called weird ideas...

but computer is totally dumb guy ... if we ask him to do anything he ll doit in d same manner ...
so his nature is predictable ...


in short we can say predictable dumb guy is more reliable... we can trust him at any extent....the only thing we need to give him proper instructions...

and thats what programming is easy ... just we need to instruct a dumb guy ... :P

lets put it in pic ...
again i am not a good artist... i hardly got more dan D grade during my school drawing course..





again sorry for my childish drawing ... :P

here m comparing our dumbo compo wid jini ...now its our responsibility to instruct our jini properly ... we ll see it in further post ... :)