title: error C2106: '=' : left operand must be l-value in C
body: <p>I am writing a code where I have to add a value to an abstract data table, but I am not sure why I cannot as it shows "error C2106: '=' : left operand must be l-value" error.</p>
  
  <pre><code>int top_add(top_string *table, const char index[257], const char other[257]) {
  
      top_remove(&amp;table, index);
  
      if (table-&gt;item_count == table-&gt;size) {
          printf("/n Table is full.");
          return -1;
      }
  
      /* error C2106: '=' : left operand must be l-value */
      table-&gt;item[table-&gt;item_count].index = index; 
  
      /*error C2106: '=' : left operand must be l-value */
      table-&gt;item[table-&gt;item_count].other = other;
  
      table-&gt;item_count++;
  
      return 1;
  }
  </code></pre>
  
  <p>I did some search online, but could not find too relative solution for me. </p>
  
  <p>I would really appreciate any hint on that.</p>
  
  <p>UPDATE:</p>
  
  <pre><code>typedef struct {
      char index[257];
      char other[257];
  } pair;
  
  
  typedef struct {
      pair *item;
      int item_count;
      int size;
  } top_string;
  
  int top_init(top_string *table, const int size) {
  
      table-&gt;item = malloc((size+1)*sizeof(top_string));
      table-&gt;size = size;
      table-&gt;item_count = 0;
  
      if (table-&gt;item == NULL) {
          return 0; /* failed to allocate memory */
      } else {
          return 1;
      }
  
  }
  </code></pre>