Rules of pointers


Int a,*b;
b=&a; (right)

Cant asing any value in adress

&a=5 ( Wrong )

Pointer and variable must be in same datatype

Pointer Always Contain 2 Bytes mamory 




Pointer of pointers

Int a,*b,**c;

b=&a;
c=&b;

*C points on b 
**C points on a


Can't add ,multiply or devide two adress ( substraction possible) but constant can add

Int a,b;
Int *c,*d;
C=&a
d=&b;

NOT Possible
&a+&b
c+d

&a*&b
c*d

&a/&b
c/d

Substraction Possible

&a-&b 
c-d

If c=140 d=120 and it's int
c-d = 10

substraction Of Adress = Normal Substraction /sizeof(variable)



Comments