Home > DeveloperSection > Forums > Difference between NSInteger and NSUInteger
sandy taylor
sandy taylor

Total Post:46

Points:324
Posted on    December-01-2015 4:12 AM

 iPhone iPhone  Ios  Objective C 
Ratings:


 1 Reply(s)
 430  View(s)
Rate this:

Can any one tell me the difference between NSInteger and NSUInteger in Objective-C?

Which is better to use in an application and why it is better?



Tarun Kumar

Total Post:210

Points:1614
Posted on    December-02-2015 10:23 PM

You always be aware of integer conversion rules dealing with NSInteger and NSUInteger.
For example: NSInteger can takes and returns negative values, and NSUInteger takes values and returns only unsigned values.

NSInteger nsinteger = -1;
NSUInteger nsuinteger = 1;
NSLog(@"%d",nsinteger<nsuinteger);

Don't want to miss updates? Please click the below button!

Follow MindStick