开发者

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

开发者 https://www.devze.com 2023-02-06 04:58 出处:网络
And i can\'t seem to figure it out. Here\'开发者_运维知识库s one of the lines it has trouble with:

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

精彩评论

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

关注公众号