Monday, February 1, 2010

pointer arithmentic

a[99]={.....}
short int* p = a;
short int** q = &p;

p++;//this means that pointer position increase one so that a[0] become a[1]
(*p)++;//this means that the value the pointer is pointing to increase one.


(*q)++;//means pointer p add 1 position so a[1] move to a[2]

(**q)++//means value of pointer q pointing to add one so the value the pointer p point to add 1

No comments:

Post a Comment