如何在Objective c ios中使用size_t *调用C ++以下函数[复制]

时间:2022-09-01 16:49:45

This question already has an answer here:

这个问题在这里已有答案:

I want to call this function void getResult(char, size_t*) in objective c.How can i do this please help me. It give me below error show in image.

我想在目标c中调用此函数void getResult(char,size_t *)。如何帮助我。它给我下面的错误显示在图像中。

如何在Objective c ios中使用size_t *调用C ++以下函数[复制]

1 个解决方案

#1


1  

It seems your getResult function expects to get second parameter by reference. You can't pass function result by reference. Assign it to actual variable first and then pass reference to that.

看来你的getResult函数希望通过引用得到第二个参数。您不能通过引用传递函数结果。首先将其分配给实际变量,然后将引用传递给它。

unsigned long sizeOfC = sizeof(c);
c->getResult(array1, &sizeOfC);

#1


1  

It seems your getResult function expects to get second parameter by reference. You can't pass function result by reference. Assign it to actual variable first and then pass reference to that.

看来你的getResult函数希望通过引用得到第二个参数。您不能通过引用传递函数结果。首先将其分配给实际变量,然后将引用传递给它。

unsigned long sizeOfC = sizeof(c);
c->getResult(array1, &sizeOfC);