Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: How to Check if an "int" Value Equals to "nil"

I have an int value defined in one of my method:

int value = [self someMethodThatGetsAnINT];

Later on I have some "ifs" that check upon this value.

How to I express: if (value == nil)?

When I try do this intuitive code writing I get a warning saying:

Semantic Issue: Comparison between pointer and integer ('int' and 'void *')

like image 401
Ohad Regev Avatar asked Aug 23 '11 11:08

Ohad Regev


1 Answers

nil is just a 0 :) Try this :

if (0 == value)

However, why would you be testing nil against an int - something sounds funny here :)

like image 177
deanWombourne Avatar answered Oct 19 '22 09:10

deanWombourne