NSMutableArray *arr1,*arr2,*arr3;
arr1=[[NSMutableArray alloc] initWithObjects:@"vijay",@"india",@"AppleVijay@facebook.com",nil];
arr2=[[NSMutableArray alloc] initWithObjects:@"vijay",@"AppleVijay@facebook.com",nil];
arr3=[[NSMutableArray alloc] init];
//Note: Here u have to properly create those arr1,arr2,arr3 arrays with alloc and init and also add objects for arr1,arr2 for compare.
for (id obj in arr2) {//each obj in arr2
if ([arr1 containsObject:obj]) {//if arr1 has the same obj(which is from arr2)
[arr3 addObject:[NSNumber numberWithInteger:[arr1 indexOfObject:obj]]];//then add that indexofobject to arr3
}
}
NSLog(@"resulted arr3 : %@ \n\n",arr3);
ВЫВОД:
resulted arr3 : (
0,
2
)