Comments | Online Safety | Help
  Below are some notes I made to help me with pointer arithmetic, you may find these useful -  
     
 

Increment the pointer -
*++pn; /* increment pn then dereference pn */
*pn++; /* dereference pn then increment pn */

Increment the value the pointer points to -
++*pn; /* dereference pn then increment this value */
(*pn)++; /* dereference pn, increment this value - value of expression is pre-incremented value */

Arithmetic on the pointer -
*(pn + 1); /* the value stored at pn + 1 */
*(pn + n); /* the value stored at pn + n */

Arithmetic on the value the pointer points to -
*pn +1; /* add one to the value pointed to by pn */

Precedence of operators is (right to left) -
( )   *   - -
           -
          ++
           +