title: Difference between NSArray and NSMutable Array
body: <p>hi am working with NSArrays using foundation tool and i have wrote the following code </p>
  
  <pre><code>    -(void)simplearrays
  {
   NSMutableArray *arr = [NSMutableArray arrayWithCapacity:3];
  
   for(int i =0;i&lt;3;i++)
   {
    scanf("%d",&amp;arr[i]);
   }
   for(int j =0; j&lt;3;j++)
   {
    printf("\n%d",arr[j]);
   }
  }
  </code></pre>
  
  <p>My query is that the above code when executed shows the given output but the i get an error once the application finishes execution which says that "can't allocate region" can you please help.</p>
  
  <p>Also i wanted to know the difference between NSArray and NSMutable Array in icode blog i have read that nsarray can dynamically resize so if NSArray can dynamically resize then why to use NSMutable array or a better one would be when to use NSArray and when to use NSMutable Array???</p>