Ok, say I do this.
NSMutableArray *array1=[NSMutableArray arrayWithObjects:@"poop", @"on", @"your", @"face", nil];
NSMutableArray *array2=array1;
[array2 removeAllObjects];
now does array1 have objects in it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Creates a mutable array object in memory with strings @”one and @”two” ..and make an array object pointer
array1point to that object in memory.Create another pointer
array2of type NSMutableArray, and make it point to the same object in memory that array1 is pointing to.Remove all strings from the mutable Array object that is pointed to by array2
Now since array1 and array2 points to the same object in memory, both array1 and array2 will now point to a mutable array object in memory that has no objects in it.