title: C Pointers & Struct
body: <pre><code>struct person {
    int age;
    char *name;
  };
  struct person first;
  struct person *ptr;
  
  first.age = 21;
  char *fullname = "Max Smith";
  first.name = fullname;
  ptr = &amp;first;
  
  printf("age=%d, name=%s\n", first.age, ptr-&gt;name);
  </code></pre>
  
  <p>I'm trying to visualize what is taking place with the pointers. </p>
  
  <p>1) We create a pointer called name which points to NULL initially. </p>
  
  <p>2) We create an instance of person, called first. </p>
  
  <p>3) We create a pointer that can only point to a "struct person".</p>
  
  <p>4) We set the instance of first, to have an age of 21. </p>
  
  <p>5) We create a pointer variable, that points to the string, "Max Smith".</p>
  
  <p>6) We set first to the value that is held in the fullname variable. </p>
  
  <p>7) Our ptr, pointer points to the values held in the first structure. </p>
  
  <p>8) We print first's age, and we tell the ptr to point to whatever value is in the structure it is pointing to's name value. </p>
  
  <p>Is my analysis correct? </p>