title: sizeof single struct member in C
body: <p>I am trying to declare a struct that is dependent upon another struct.
  I want to use <code>sizeof</code> to be safe/pedantic.</p>
  
  <pre><code>typedef struct _parent
  {
    float calc ;
    char text[255] ;
    int used ;
  } parent_t ;
  </code></pre>
  
  <p>Now I want to declare a struct <code>child_t</code> that has the same size as <code>parent_t.text</code>.</p>
  
  <p>How can I do this?  (Pseudo-code below.)</p>
  
  <pre><code>typedef struct _child
  {
    char flag ;
    char text[sizeof(parent_t.text)] ;
    int used ;
  } child_t ;
  </code></pre>
  
  <p>I tried a few different ways with <code>parent_t</code> and <code>struct _parent</code>, but my compiler will not accept.</p>
  
  <p>As a trick, this seems to work:</p>
  
  <pre><code>parent_t* dummy ;
  typedef struct _child
  {
    char flag ;
    char text[sizeof(dummy-&gt;text)] ;
    int used ;
  } child_t ;
  </code></pre>
  
  <p>Is it possible to declare <code>child_t</code> without the use of <code>dummy</code>?</p>