Re: Confusion
Re: Confusion
- Subject: Re: Confusion
- From: chamlin <email@hidden>
- Date: Sun, 24 Jun 2001 15:07:30 -0400
On Sunday, June 24, 2001, at 01:51 PM, email@hidden wrote:
If I declare:
NSString *myName;
I am stating that myName is of type NSString. So, in a loose sense
myName is pointing to NSString.
No, not in a loose sense. myName is a spot in memory that holds the
address of _an_ NSString. If you were to get the value of myName, it
would
just be a number, not an NSString. When you dereference a pointer, you
take its value and use that as a _pointer_ to the memory address of the
thing you are pointing to.
So, if you have myName, it could have (as an example), a value of
12345. And at the memory address 12345, you would find the NSString
that you could get by dereferencing myName.
Probably it would be best to ignore the OO implications, since
the pointer stuff comes right from straight C. After that, the OO
part of it should be fairly easy. But you'll probably be very confused
until you get "regular" C pointers.
ch