title: Accessing a general structure member using a variable
body: <p>Not entirely sure my question title describes what I want to do, but couldn't think how better to word it!!  I'm using C, and perhaps the pseudocode below will describe what I'm trying to do:</p>
  
  <pre><code>typedef struct obj
  {
      char *str1;
      char *str2;
      char *str3;
  } object;
  
  /* global variable */
  object *glob;
  
  void black_box_function(local, member) ????
  {
      /* Do something with glob-&gt;member and local-&gt;member */
  }
  
  void main()
  {
      object *ob1, *ob2;
  
      /* Initialise glob, ob1 and ob2 somewhere */
  
      black_box_function(ob1, str1);
      black_box_function(ob2, str3);
  
  }
  </code></pre>
  
  <p>Hopefully, you can see what I'm trying to do. I have a "black-box" function that will do something with a particular member, and I need to be able to tell the black-box function which member to use.</p>
  
  <p>I don't want to just pass the member directly to the function, like in this code, as that won't fit into the rest of my code easily.</p>
  
  <pre><code>black_box_function(ob1-&gt;member, glob-&gt;member)
  </code></pre>