Difference between int, NSInteger and NSUInteger

Hitarth picture Hitarth · Oct 2, 2011 · Viewed 21.6k times · Source

What is the main difference between int, NSInteger and NSUInteger in Objective-C?

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

Answer

Bastian picture Bastian · Oct 2, 2011

In such cases you might right click and go to definition:

#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif