title: C - Member reference base type 'int' is not a structure or union
body: <p>I have some structs declared, see here:</p>
  
  <pre><code>struct cache_1_way{
      int size;
      int set[1][1];
  };
  
  struct cache_2_way{
      int size;
      int set[2][2];
  };
  struct cache_4_way{
      int size;
      int set[2][4];
  };
  </code></pre>
  
  <p>I create an array of a struct based on associativity, and then initialize the values in the array of structs.</p>
  
  <pre><code>struct cache_4_way cache[set_count];
  for(int i = 0; i &lt; set_count; i++){
      cache[i].size = 4;
      cache[i].set = {{0,0,0,0},
                      {0,1,2,3}};
  }
  </code></pre>
  
  <p>In order to insert an element into my cache, I use a pre calculated set location value to index a certain struct object. However, I get the error, as mentioned in the title, whenever I try doing something like this:</p>
  
  <pre><code>for(int j = 0; j &lt; cache[set_loc].size; j++){
      //code here
  }
  </code></pre>
  
  <p>This doesn't make any sense. I'm able to initialize the cache array just fine, but when I try indexing the struct object at set_loc and accessing the size attribute, I get this error. I'm completely stumped on why I'm getting the error "Member reference base type 'int' is not a structure or union" every time I try indexing my cache array. Can someone please assist me here? Thanks</p>