title: Passing char array to struct member
body: <p>I have the following structure:</p>
  
  <pre><code>struct hashItem {
      char userid[8];
      char name[30];
      struct hashItem *next;
  };
  </code></pre>
  
  <p>In the function below I take a char pointer (char array) argument that I wish to assign to the struct.</p>
  
  <pre><code>void insertItem(struct hashItem *htable[], char *userid, char *name)
  {
      int hcode = hashCode(userid);
      struct hashItem *current = htable[hcode];
  
      struct hashItem *newItem = (struct hashItem*) malloc(sizeof(struct hashItem));
      newItem-&gt;userid = userid;
      newItem-&gt;name = name;
      [...]
  }
  </code></pre>
  
  <p>Instead I get the following error:</p>
  
  <pre><code>hashtable.c: In function ‘insertItem’:
  hashtable.c:62: error: incompatible types in assignment
  hashtable.c:63: error: incompatible types in assignment
  </code></pre>
  
  <p>Line 62 and 63 are the `newItem->..." lines.</p>