title: c++ tables of unions and structures
body: <p>I was told to write a program, that creates a union and structure, then creates two-element arrays of unions and structures and fills their fields. I have created a union and a structure, but how to fill their fields in arrays ?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  using namespace std;
  
  union complex;
  
  union complex{
        int i1;
        long double ld1;
        } u;
  
  struct Person {
      char* name;
      int age;
      bool sex;
      void show(){
      printf("name %s, age %2.0d, sex %1d\n",
          name , age, sex);        
      };
  } person;
  
  int main(void)
  { 
  
      Person *o = new Person[2];
      complex *un = new complex[2];
  
      un[0]-&gt;i1=i;  
  
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>I've tried un[0]->i1=i; but it's not the proper way to do this.</p>