Confused about copying Arrays in Objective-C

Posted by Sheehan Alam on Stack Overflow See other posts from Stack Overflow or by Sheehan Alam
Published on 2010-06-08T02:02:58Z Indexed on 2010/06/08 2:22 UTC
Read the original article Hit count: 393

Filed under:
|
|
|
|

Lets say I have an array X that contains [A,B,C,D,nil];

and I have a second array Y that contains [E,F,G,H,I,J,nil];

If I execute the following:

//Append y to x
[x addObjectsFromArray:y];

//Empty y and copy x
[y removeAllObjects];
y = [x mutableCopy];

What is the value of y? is it?:

[A,B,C,D,E,F,G,H,I,J,nil]

Am I performing the copy correctly?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c