title: Objective C NSMutableArray work with nil
body: <p>I want to create a <code>NSMutableArray</code> to represent a game board that holds grid element (assume I have a <em>chess</em> class). In this case, I already know the size of the board so I want to create an array by <code>initWithCapacity:[size]</code> and then initialize them as <code>nil</code>. During the game, I may insert or remove <em>chess</em> object into/from this array based on game. I need to check if some cell is <code>nil</code> sometimes.</p>
  
  <p>Clearly <code>initWithCapacity</code> only allocate memory, but gives an empty array whose element is not assessable. I think insert <code>[NSNull null]</code> one by one is inefficient (I can turn to use 0 to represent <code>nil</code> but still not what I want).</p>
  
  <p>Is there any type/structure in Objective C like a C/C++ array for my purpose? Or is it wise to use C/C++ array here? (e.g. <code>Chess myArray[size]</code>)</p>