Reputation: 841
int k = 0;
k = [myArray indexOfObject:_endNode];
I only have a few objects added to the array and _endNode isn't one of them.
I expect my k value to be -1. But, my k on the second line gives me a value of 21787887.
Upvotes: 10
Views: 12370
Reputation: 122
It's actually NSNotFound
ans defined as NSIntegerMax
NSArray *array = [[NSArray arrayWithObject:_endNode] arrayByAddingObjectsFromArray:Myarray];
int k;
k=[array indexOfObject:_endNode];
Upvotes: 0
Reputation: 2740
This information may help you,
I think there is no DATA in you _endNode so its returning the junk value for the "k"
Please check the values of _endNode.....
Upvotes: 0
Reputation: 243156
It's actually NSNotFound
, which is defined as NSIntegerMax
.
This, by the way, is quite explicit in the documentation.
Upvotes: 26