title: How to make an array of struct in C?
body: <p>I am making a roguelike game. I want to represent the map as an array of structs, for example having 256 structs in an array. The map is a 16*16 grid of tiles, and each tile has attributes, such as whether there is an item on top of it.</p>
  
  <p>So say that I want an array of 256 of the struct <code>tiles</code>:</p>
  
  <pre><code>struct tiles {
          char type; /* e.g. dirt, door, wall, etc... */
          char item; /* item on top of it, if any */
          char enty; /* entity on top of it, e.g. player, orc if any */
  }
  </code></pre>
  
  <p>Then, I need to access an array of that structs something like this:</p>
  
  <pre><code>int main(void)
  {
          unsigned short int i;
          struct tiles[256];
  
          for (i = 1; i &lt;= 256; i++) {
                  struct tiles[i].type = stuff;
                  struct tiles[i].item = morestuff;
                  struct tiles[i].enty = evenmorestuff;
          }
  }
  </code></pre>