title: dynamic array in structure with consecutive memory?
body: <pre><code>struct Test
  {
      int var;
      char *arr;
  }
  
  int main()
  {
      Test a;
      a.arr = new char[50];
  }
  </code></pre>
  
  <p>The above code would create a dynamic array in the structure but the dynamic array would not be actually memory allocated within the structure, its memory would be allocated somewhere else. I want this array to be allocated in the structure as with the fixed array but I don't want to use fixed array. Any ideas?
  I've tried my best to clarify my question, hope you understand.</p>
  
  <p>I want to send this structure through UDP and UDP takes continues memory buffer to send that's why I want this structure to have continuous memory.</p>