ios - ios 中需要左值作为赋值的左操作数

标签 ios variable-assignment lvalue operand

这是我的代码

[[X objectAtIndex:i] doubleValue] = ([[X objectAtIndex:i-1]doubleValue] * [[X objectAtIndex:1]doubleValue]);

其中 X 是 double 组

谢谢

最佳答案

要设置值,您必须使用 set 方法,如下所示:

double d = [[X objectAtIndex:i-1] doubleValue] * [[X objectAtIndex:1] doubleValue];
[[X objectAtIndex:i] setDoubleValue:d];

关于ios - ios 中需要左值作为赋值的左操作数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10106481/

相关文章:

c - 为什么 this 的结果不是左值?

iphone - iOS 6.0 中的界面方向

ios - 弹回 View Controller 时使用 ARC 的 EXC_BAD_ACCESS

ios - 方法不覆盖其父类(super class)中的任何方法 : Swift/UITableViewController/MapKit

c - C 数组和素数

java - 赋值表达式的编译错误

ios - VSTS上的Xamarin测试云故障

variable-assignment - Nim 中 `let` 赋值的语义

c - 为什么我不能取返回值的地址?

c++ - 为什么 const 函数返回左值而不是右值?