If I have this in my .h
file:
int index;
And then in the .m
file I have:
if (index == nil)
nil is a specific value reserved for Objective-C object pointers. It is very similar to NULL (0) but has different semantics when used with message passing.
local primitive data types like int's are not initialized in Objective-C. The value of index will not be defined until you write to it.
void foo () {
//initialize local variable
int x = 5;
}
//initialise static variable
static int var = 6;