Can you set NSInteger as NULL in Objective-C?

I am trying to set NSInteger to NULL. Although the compiler does not give any errors, but I'm not sure if this is the right way to do this. Can you set NSInteger as NULL in ios ..? Or is it forbidden for some reason? .. Or should I install it on Nil ..? What's better?..

thanks

+7
objective-c nsinteger
source share
1 answer

I think you are confusing NSInteger with the Objective-C class.

NSInteger is just a typedef d integer:

 #if __LP64__ || NS_BUILD_32_LIKE_64 typedef long NSInteger; typedef unsigned long NSUInteger; #else typedef int NSInteger; typedef unsigned int NSUInteger; #endif 

If you want something that contains a number, which may be nil , then you probably want NSNumber .

+10
source share

All Articles