title: Using realloc for dynamic array size vs. initial size in C
body: <p>I am new to C language (coming from java) and wondering what is a better approach in my situation.  I am programming a game and in the function where i generate the moves, i want to return some pointer to an array of structs (a Move is represented by a struct).</p>
  
  <p>Because i don't know in advance what will be the array size, i thought about starting with an empty array an than resize it every time i want to add a move (by realloc(size+1)).   but i wonder if it is more optimal to just set an initial size and if i need to,just double the size.      what is the better approach performance wize?</p>
  
  <p>Thank you!</p>