title: How to allocate a char array with malloc()?
body: <p>I have a problem trying to fill this array. Could someone explain what's going wrong?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  typedef struct T
  {
    char TpCode[4];
  
  }T;
  
  int main(int argc, char **argv)
  {
    T *tp;
    tp-&gt;TpCode =(char *)malloc(4* sizeof(char));
  }
  </code></pre>