Objective-c pointer assignment and reassignment dilema
- by moshe
Hi,
If I do this:
1 NSMutableArray *near = [[NSMutableArray alloc] init];
2 NSMutableArray *all = [[NSMutableArray alloc] init];
3 NSMutableArray *current = near;
4 current = all;
What happens to near?
At line 3, am I setting current to point to the same address as near so that I now have two variables pointing to the same place in memory, or am I setting current to point to the location of near in memory such that I now have this structure:
current - near - NSMutableArray
The obvious difference would be the value of near at line 4. If the former is happening, near is untouched and still points to its initial place in memory. If the latter is happening,