master struct pointing to other structs- how to use the values outside of main
<p>So I have 3 files:</p>

<ol>
<li>.h file: have my structs, a, b, &amp; c,  stored here</li>
<li>.cpp file: contains some functions I have written</li>
<li>.cpp main file: contains my main</li>
</ol>

<p>In my .h file, I have multiple structs, lets say:</p>

<pre><code>    struct a{
..many fields of different types.....
};

struct b{
...many different fields of different types...
};

struct c{
.......many different fields of different types
};
</code></pre>

<p>Now, I want to create another struct, that holds pointers to these structs, lets say:</p>

<pre><code>struct master{
  a *first;
  b *second;
  c *third;
};
</code></pre>

<p>In my cpp file where I write my functions I need everything to be "declared" so that I can use all the fields of a, b, and c in my functions before getting to main. The purpose of this is that as I write functions I'm needing to pass too many parameters (there's over 20 fields of some structs)that's just making everything cluttered. </p>

<p>So where would my master struct go? How can everything be declared in such a way that I can use, lets say the value "x" from struct a when writing functions? How do I declare struct a, b, and c so that master struct recognizes them as the exact a, b, and c it points to?</p>

<p>These obviously aren't the actual structs from my problem. I tried to give a simple example so any questions are welcome. The master struct is vital to my program design. I'm writing in C++</p>

<p>EDIT EDIT:
structures.h:</p>

<pre><code>struct a{
  int x;
  int w;
};

struct b{
  int y;
  int z;
};

struct master{  //if this should even go in .h?
  a *first;
  b * second;
};
</code></pre>

<p>functions.cc:</p>

<p>master myMaster;</p>

<pre><code> int add(int y){
      int myValue = y + m.second-&gt;x;
      return myValue;
    }
</code></pre>

<p>main.cc:</p>

<pre><code> int main (void) {
    extern master myMaster;
    a myA;
    myMaster.first = &amp;myA;
    myMaster.first-&gt;x  = 10;
    int y = 3;
    int myValue = add(y);
  }
</code></pre>