tags:

views:

12

answers:

1

How can I check if an int has been assigned a value? Or is still un defined?

Thanks

+1  A: 

You can't. There is no concept of undefined or null int.

Objective-C is basically, C. So, initially, and unasigned int will have the value of whatever there is on that part of the memory. If you need it to have a starting value, you should explicitly set one.

Pablo Santa Cruz
Oh Ok. So I should give it a starting value
It's good practice. You should never read or trust the initial value of an `int`. Just assign it a value on definition.
Pablo Santa Cruz