- The null pointer is a special kind of pointer that doesn’t point to anything.
- Pointer can be “emptied” using the null pointer.
- A good rule of thumb is to use nil for variables that hold Objective-C objects and NULL when working with C pointers.
NSString *anObject; // An Objective-C object anObject = NULL; // This will work anObject = nil; // But this is preferred int *aPointer; // A plain old C pointer aPointer = nil; // Don't do this aPointer = NULL; // Do this instead
No comments:
Post a Comment