title: How to realloc an array of structs
body: <p>Using c, I'm trying to input stuff into an array of structs, and once that array is filled, double the size of the array and keep going, using realloc. </p>
  
  <p>I know there's been several question like this asked already, but I was hoping someone could explain it clearly since I didn't create my array the way those questions did and am getting a bit confused.</p>
  
  <p>I have a struct</p>
  
  <pre><code>struct Data {
      // Some variables
  }
  </code></pre>
  
  <p>and initialised the array using</p>
  
  <pre><code>struct Data entries[100];
  int curEntries = 100;
  int counter = 1; // index, I use (counter - 1) when accessing
  </code></pre>
  
  <p>To realloc, I'm currently using</p>
  
  <pre><code>if(counter == curEntries){  // counter = index of array, curEntries = total
      entries = realloc(entries, curEntries * 2);
  }
  </code></pre>
  
  <p>I know I need to cast realloc to something right? I'm just not sure how or what I'm meant to be casting it to, so I currently don't have anything, which of course gives me the error "assignment to expression with array type"</p>
  
  <p>Thanks!</p>