Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 作为参数的ivar地址_Iphone_C_Pointers - Fatal编程技术网

Iphone 作为参数的ivar地址

Iphone 作为参数的ivar地址,iphone,c,pointers,Iphone,C,Pointers,我试图调用函数,但出现错误: 警告:从不兼容的指针类型传递“drawPlot”的参数1 listData当然是NSMutableArraylistData的定义应该如下所示: NSMutableAarray listData; //OR NSMutableAarray listData[]; 如果是前者,则将drawPlot调用更改为 drawPlot(&listData[0]) // OR drawPlot(listData) drawPlot(&listData

我试图调用函数,但出现错误:

警告:从不兼容的指针类型传递“drawPlot”的参数1


listData当然是NSMutableArray

listData的定义应该如下所示:

NSMutableAarray listData;  //OR 
NSMutableAarray listData[]; 
如果是前者,则将drawPlot调用更改为

drawPlot(&listData[0])  // OR
drawPlot(listData)
drawPlot(&listData [ the index of the listData array member you want to plot]);  // does it work now?  
如果是后者,则将drawPlot调用更改为

drawPlot(&listData[0])  // OR
drawPlot(listData)
drawPlot(&listData [ the index of the listData array member you want to plot]);  // does it work now?  

listData的定义应类似于:

NSMutableAarray listData;  //OR 
NSMutableAarray listData[]; 
如果是前者,则将drawPlot调用更改为

drawPlot(&listData[0])  // OR
drawPlot(listData)
drawPlot(&listData [ the index of the listData array member you want to plot]);  // does it work now?  
如果是后者,则将drawPlot调用更改为

drawPlot(&listData[0])  // OR
drawPlot(listData)
drawPlot(&listData [ the index of the listData array member you want to plot]);  // does it work now?  

删除&。您的变量已经是指针。我假设您这样声明:
NSMutableArray*listData

因此,使用&就是将“指向指针的指针”传递给一个函数,该函数只需要指向NSMutableArray的指针

现在,SDK中有许多地方需要
NSError**
。此时您将使用&,例如:

NSError *error = nil; ... [SomeClass doSomethingReturningError:&error]; if (error != nil) { //something bad happened }
按值传递不允许修改参数,而按引用传递则允许修改参数。

删除&。您的变量已经是指针。我假设您这样声明:
NSMutableArray*listData

因此,使用&就是将“指向指针的指针”传递给一个函数,该函数只需要指向NSMutableArray的指针

现在,SDK中有许多地方需要
NSError**
。此时您将使用&,例如:

NSError *error = nil; ... [SomeClass doSomethingReturningError:&error]; if (error != nil) { //something bad happened }
按值传递不允许修改参数,而按引用传递则允许修改参数。

您确定这不是
NSMutableArray*
?当然是我的错,它应该是不带符号的listData。您确定它不是
NSMutableArray*
?当然是我的错,它应该是不带符号的listData。