Another Pointer Example

int a, b;
int *ptr1, *ptr2;  /* Declare 2 pointers to int,    */
                   /* ptr1 and ptr2                 */

a = 1;
b = 2;

ptr1 = &a;        /* ptr1 holds the address of a    */   
ptr2 = &b;        /* ptr2 holds the address of b    */   

*ptr1 = 11;       /* Put the value 11 into the      */
                  /* container that ptr1 points to  */

*ptr2 = 22;       /* Put the value 22 into the      */
                  /* container that ptr2 points to  */

ptr1 = ptr2;      /* Let the variable ptr1 now hold */ 
	          /* the same address as ptr2 holds */

*ptr1 = 99;       /* Put the value 99 into the      */
                  /* container that ptr1 points to  */

ptr1 = &a;        /* ptr1 holds the address of a    */
   
*ptr1 = *ptr2;    /* Put the value found at the     */
                  /* address that ptr2 points to    */
	          /* into the container that ptr1   */
	          /* points to.                     */