title: C: How to store 2d Char array in a struct?
body: <p>I want to have a 2d char array, and when I don't use the struct I can loop through the array and print out the strings. However if I assign the 2d char array to a struct member, I cannot access the array, why?</p>
  
  <pre><code>typedef struct {
      int num;
      char **names;
  } test;
  
  
  test t;
  t.num = 2;
  char *names[t.num];
  char *tmp;
  tmp = "test";
  
  names[0] = "something";
  strcpy(tmp,names[0]);
  strcat(tmp,"appendedtext");
  names[1] = tmp;
  names[2] = "something else";
  
  
  t.names = names;
  </code></pre>