title: iOS: update an NSMutableArray
body: <p>I have this code:
  I want to store some vales in a day of the year, I set period for example 15/05/2011 to 20/05/2011</p>
  
  <p>in viewDidLoad:
  I store null value then I can store a value everywhere I want in the array, I'm using "sentinel values":</p>
  
  <pre><code>appDelegate.years = [[NSMutableArray alloc] init];
  
  for (int i = 0; i &lt; 50; i++) // I set 50 years
  {
      [appDelegate.years insertObject:[NSNull null] atIndex:i];
  }
  
  months = [[NSMutableArray alloc] init];
  for (int i = 0; i &lt; 12; i++)
  {
      [months insertObject:[NSNull null] atIndex:i];
  }
  
  days = [[NSMutableArray alloc] init];
  for (int i = 0; i &lt; 31; i++)
  {
      [days insertObject:[NSNull null] atIndex:i];
  }
  </code></pre>
  
  <p>In my method:</p>
  
  <pre><code>int firstDay = 15;
  int lastDay = 20;
  int firstMonth = 4; 
  int lastMonth = 4;
  NSString *string = first; //this is the value that I want to store in the period
  
  
  for (int i = firstMonth; i &lt; lastMonth+1; i++) 
  {
  
      for (int j = firstDay; j &lt; lastDay+1; j++)  
      {
          NSMutableArray *values = [[NSMutableArray alloc] init];
              [values addObject:string];
              [days replaceObjectAtIndex:j withObject: values];
              [values release];
      }
  
      [months replaceObjectAtIndex:i withObject:days];
  
  }
  
  [appDelegate.years replaceObjectAtIndex:0 withObject:months]; //0 is 2011
  </code></pre>
  
  <p>OK, in this code I store a value in an array "values" that I store in one index of array "days" that I store in one index of array "month" that I store in one index of array "year", it work fine; but  after this, if I want store another string in array values in same position? </p>
  
  <p>Example: I have another NSString *string2 = "second" and I want store this string in the same position of day then I want in same day the array values with "first" and "second", then I can't do "[days replaceObjectAtIndex:j withObject: values];" but what Can i do?</p>