-6

I have stored three arrays inside another array. Now I need to separate those three arrays and store in three different arrays. How to do this?

Nsmutablearray *arr=[[nsmutablearray alloc]initwithobjects:arr1,arr2,arr3];

now i need to divide it to following model

Nsmutablearray *firstarr=arr1;

Nsmutablearray *secondarr=arr2;

Nsmutablearray *thirdarr=arr3;

I need to do this in for in loop.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
yashwanth
  • 1
  • 4

2 Answers2

0

Could this be what you're looking for?

NSMutableArray *firstArray = arr[0];
NSMutableArray *secondArray = arr[1];
NSMutableArray *thirdArray = arr[2];

Note that the NSArray class uses the Objective-C subscripting syntax as shorthand for [arr objectAtIndex:0] (these are equivalent, but it's shorter and clearer to write it as an array subscript).

Greg
  • 9,068
  • 6
  • 49
  • 91
0

Use it with array index you can separate all array..

 // Array at Index 0
 NSArray *firstarr=arr[0];
 // Array at Index 1
 NSArray *secondarr=arr[1];
 // Array at Index 2
 NSArray *thirdarr=arr3[2];
Parvendra Singh
  • 965
  • 7
  • 19