we assign int value to x as normal
int x;
x = 100;
but for pointer,we assign like this
y = &x; //that means y will contains x's address
if we print *y ,that means we print value of x,because * get object of that pointer point to.
here is a table that summarize all of those operators
expression | can be read as |
---|---|
*x | pointed by x |
&x | address of x |
x.y | member y of object x |
x->y | member y of object pointed by x |
(*x).y | member y of object pointed by x (equivalent to the previous one) |
x[0] | first object pointed by x |
x[1] | second object pointed by x |
x[n] | (n+1)th object pointed by x |
No comments:
Post a Comment