title: Nested arrays in Objective-C ( NSMutableArray )
body: <p>I'm trying to build a nested array: First, I make a "PlayerItems" array which will contain 10 arrays, each containing item objects, corresponding to the inventories of each player in the game. On the indicated line, I get the following error:</p>
  
  <blockquote>
    <p>error: void valued not ignored as it ought to be</p>
  </blockquote>
  
  <p>What is the void value here? If I used <code>[[PlayerItems objectAtIndex:i] addObject:myitem]</code> instead, the program compiles but crashes. If I comment that line out, it compiles and runs OK. Thank you for your help!</p>
  
  <pre><code>self.PlayerItems = [[NSMutableArray alloc] initWithCapacity:11];
  NSMutableArray *itemarray = [[NSMutableArray alloc] initWithCapacity:60];
  item *myitem = [[item alloc] init];
  item.kind = 1;
  for (int i = 1; i &lt; 10; i++) {
      itemarray = [[NSMutableArray alloc] initWithCapacity:60];
      [PlayerItems addObject:itemarray];
      for (int i2 = 1; i2 &lt; 50; i2++) {
          myitem = [[item alloc] init];
          myitem.kind = 1;
          // The error occurs on the line below:
          ((NSMutableArray *) [[PlayerItems objectAtIndex:i] addObject:myitem]);
      }
  }
  </code></pre>