title: C pointer math with structures
body: <p>Trying to learn pointer math better I wrote this code.  The intention was to increment the pointer threw the structure and print it's members. I know how to print it's member easier ways but would really like to know how my pointer math is messed up.  Thank you.</p>
  
  <pre><code>typedef struct{ 
    int num;
    int num2;
    char *string;
  } astruct ;
  
  int main (int argc, const char * argv[])
  {
    astruct mystruct = { 1234, 4567,"aaaaaaa"};
  
    astruct *address;
    address = &amp;mystruct;
  
    // this does print 1234
    printf("address 0x%x has value of:%i\n",address, *address); 
    address = address + sizeof(int);
  
    //this does NOT print 4567
    printf("address 0x%x has value of:%i\n",address, *address); 
    address = address + sizeof(int);
  
    //this crashes the program, I wanted to print aaaaaaaa
    printf("address 0x%x has value of:%s\n",address, **address); 
  
    return 0;
  }
  </code></pre>