// Function to use structures containing pointers

#include <stdio.h>

int main (void)
{
     struct  intPtrs
     {
          int  *p1;
          int  *p2;
     };

     struct intPtrs  pointers;
     int  i1 = 100, i2;

     /*access elements of a struct the same way using '.' -  p1 is a 
      *pointer so set it equal to the address of i1 also p2 is a pointer,
      *set p2 to the address of i2.  Now using indirection set the variable
      *pointed to by pointers.p2 to -97*/

     pointers.p1 = &i1; 
     pointers.p2 = &i2;
     *pointers.p2 = -97;
     /*Again remember the '*' in front of pointers.p1 means get the value where 
       pointers.p1 and pointers.p2 are pointing*/
     printf ("i1 = %i, *pointers.p1 = %i\n", i1, *pointers.p1);
     printf ("i2 = %i, *pointers.p2 = %i\n", i2, *pointers.p2);
     return 0;
}
