If I store an NSNumber that is equal to 0 in an NSMutableArray will that be interpreted as nil and cause issues with the count method?
If I store an NSNumber that is equal to 0 in an NSMutableArray will
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, you have to differentiate between the object id itself and the contents. The contents of an
NSNumberset to 0 may well be zero but the id for said object is actually a real address.For example, the object id
0x2222may look like this in memory (very simplified):You can see the the object id is not zero but a real value. The contents of the object are zero but that’s not relevant to the object id.
The things that goes in the mutable array are the id values for objects, not the contents of those objects.