title: How can I declare a structure of an unknow size?
body: <p>I have this structure :</p>
  
  <pre><code>  struct          __attribute__((packed)) BabelPacket
    {
      unsigned      senderId;
      unsigned      dataLength;
      unsigned char data[0];
    };
  </code></pre>
  
  <p>And to declare it I do : </p>
  
  <pre><code>  BabelPacket *packet = reinterpret_cast&lt;BabelPacket *&gt;(new char[sizeof(BabelPacket) + 5]);
    packet-&gt;senderId = 1;
    packet-&gt;data = "kappa";
    packet-&gt;dataLength = 5;
  </code></pre>
  
  <p>But when I compile I have this error : </p>
  
  <pre><code>error: incompatible types in assignment of ‘const char [6]’ to ‘unsigned char [0]’
     packet-&gt;data = "kappa";
  
              ^
  </code></pre>
  
  <p>Have you an idea how I can do that ? 
  And I need to send this structure through a socket, to get the object back in my server, so I can use only C types.</p>