开发者

Getting a 'Assignment makes integer from pointer without cast' error

And i can't seem to figure it out. Here'开发者_运维知识库s one of the lines it has trouble with:

hourToReadOut = currentHourInt - 12;

hoursToReadOut and currentHoursInt are both integers from the .h file. currentHourInt is always set to something.


This error is given when you assign a pointer to an integer:

int *intPtr;
int intVar;
intVar = intPtr - 12;

It looks like currentHourInt is a pointer, not an integer, are you really sure it's not?


Did you maybe declare one as a pointer to an int? NSInteger* when you meant NSInteger or int* instead of int? Or is one perhaps an NSNumber object from which you should be calling intValue?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜