---
title: "In iOS what we prefer NSInteger or int"  
description: "In iOS what we prefer NSInteger or int"  
author: "Anonymous User"  
published: 2015-12-08  
updated: 2015-12-09  
canonical: https://www.mindstick.com/forum/33701/in-ios-what-we-prefer-nsinteger-or-int  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# In iOS what we prefer NSInteger or int

Can any one tell me the benefit to using the NS types our the built-ins. and which we prefer and why?

Is [int](https://www.mindstick.com/forum/159137/how-to-convert-date-int-to-date-in-sql) and NSInteger has the same width on 32/64 [bit](https://www.mindstick.com/forum/33411/how-we-tell-programmatically-if-i-m-running-in-64-bit-jvm-or-32-bit-jvm) [platforms](https://www.mindstick.com/articles/126146/the-current-scenario-of-cryptocurrency-exchange-platforms)?

## Replies

### Reply by Tarun Kumar

In my according NSInteger have all the features of safe architecture versions of the corresponding C types, basically its size changes depending on the architecture. and NSInteger is guaranteed to hold any valid pointer for the current architecture.

Apple also recommends that you use these to work with OS-X and onwards, and Apple's APIs will use them, so it is definitely a good idea to get into the habit of using them. It require a little more typing, but it is a part from that it doesn't seem to be any reason not to use them.


---

Original Source: https://www.mindstick.com/forum/33701/in-ios-what-we-prefer-nsinteger-or-int

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
