iphone - 出现 'Assignment makes integer from pointer without cast' 错误

标签 iphone objective-c c cocoa-touch

我似乎无法弄明白。这是它遇到问题的行之一:

hourToReadOut = currentHourInt - 12;

hoursToReadOutcurrentHoursInt 都是 .h 文件中的整数。 currentHourInt 总是设置为某物。

最佳答案

当您将指针分配给整数时会出现此错误:

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

看起来 currentHourInt 是一个指针,而不是一个整数,你确定不是吗?

关于iphone - 出现 'Assignment makes integer from pointer without cast' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4761456/

相关文章:

ios - swift 在 Xcode 中编译时出现退出代码 1 失败 - 可能与 Bridging-Headers 有关

c - 以下用 C 编写的程序的输出是什么?

C 如何计算long变量中最长的连续0序列的长度?

ios - 未调用委托(delegate)方法 : IOS 6

iphone - 如何在 UINavigationBar 上获取 'matte' 颜色?

objective-c - UiimageView 适配于 uiview

c++ - 如何使用指向指针的指针

iphone - 关闭模态视图时在 IOS 5 中崩溃

iphone - 修改iphone SDK中的日期选择器

ios - 尝试在 iOS 8 中以横向模式而不是纵向模式显示键盘