Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SqueegyX

macrumors regular
Original poster
Mar 24, 2008
108
1
I've seen in some Objective-C code a double ** in variable declarations. For the most part, I understand the difference between with * and without. I know the difference between between a pointer non-pointer.

But what would this mean?

Code:
NSString **myString;

Is that a pointer to a pointer?
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
With pointers to pointers, you can quickly change the order in which you access data without physically moving any data.

Also, if the data you are dealing with is all based in the heap, your structures will typically consist of pointers to data, rather than the actual data.

The extra level of indirection can actually make programming simpler.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.