二进制表达式的操作数无效('double'和'double')objective-c issue
-(double)performOperationWith:(double *)operand1
And:(double *)operand2 {
double result = 0.0;
result = operand1 + operand2;
return result;
}
答案 0 :(得分:3)
他们是指针,所以你应该取消引用它们:
result = *operand1 + *operand2;
或更改功能参数:
-(double)performOperationWith:(double )operand1 And:(double )operand2 {...}
答案 1 :(得分:2)
只需删除*
:
-(double)performOperationWith:(double)operand1 And:(double)operand2 {
double result = 0.0;
result = operand1 + operand2;
return result;
}