i have tried following method to search an object using binary search but the result is coming some garbage value.
NSArray *orderedSet = [[NSArray alloc]initWithObjects:@2,@3,@5,nil];
NSLog(@"%@",orderedSet);
NSLog(@"%lu",(unsigned long)[orderedSet indexOfObject:@3 inSortedRange:NSMakeRange(0, 3) options:NSBinarySearchingFirstEqual usingComparator:^NSComparisonResult(id obj1, id obj2) {
return [obj2 compare:obj1];
}]);
It output the 9223372036854775807, Can anyone let me know what i am doing wrong here.
change short Range from (0,3) to (0,2)