NSUInteger


#1

In the following example in the book:
NSUInteger charCount = [x length]

Why is it charCount and not *charCount since NSUInteger is a class? For all other classes, it needed a pointer. Thanks!


#2

NSUInteger is not a class; it is a primitive type.

It is another name (or alias) for either an unsigned long or an unsigned int.


#3

That makes a lot of sense. This might be a dumb question, but how do I know NSUInteger is not a class? I thought it was since it was capitailzed. I’m guessing it’s not as simple as that. Thanks again!


#4

Apple’s documentation browser (Organizer in Xcode) is the best way to find out. If you search on a class, the result will come up with a [C] box; any native types (primarily integers) will have a [T] box next to the name.


#5

You can also Command-click it in Xcode to open up the header file in which it is defined. (This works for also class types.)


#6

Thanks ibex10! That was a HUGE help for me. I was wondering how to easily get to the header files to see under the hood. That’s AWESOME!! :smiley: