title: character array is not working as expected (concatenation of two arrays)
body: <pre><code>#include &lt;stdio.h&gt;
  
  typedef struct _Text { 
    char *str; //pointer to string
    int length; //length of the text
    int counter; //counter of text pointing this struct
    } *Text;
  
    Text concat(Text txt1, Text txt2){
      Text txt= malloc(sizeof(*txt));
      txt-&gt;length=txt1-&gt;length+txt2-&gt;length; 
      txt-&gt;counter=1;
  
      char str[txt-&gt;length];
      
      for(int i=0; txt1-&gt;length&gt;i;i++){ //first word concat
        str[i]=txt1-&gt;str[i];
        }
      
      for(int i=0; txt2-&gt;length&gt;i;i++){ //second word concat
        str[i+txt1-&gt;length]=txt2-&gt;str[i];
        }
      txt-&gt;str=str;
      return txt;
        }
  
  int main(void) {
    
    Text txt= malloc(sizeof(*txt));
    Text txt1= malloc(sizeof(*txt1));
    txt-&gt;str=&quot;hello&quot;; txt-&gt;length=5; txt-&gt;counter=1;
    txt1-&gt;str=&quot;lo&quot;; txt1-&gt;length=2; txt1-&gt;counter=1;
    concat(txt,txt1);
    
    return 0;
  }
  </code></pre>
  <p>The return value of concat is not the value it should be, it seems like it is not saving the value of str, the correct return should be &quot;hellolo&quot;, but it returns &quot;hello&quot;</p>