【发布时间】:2014-02-12 10:32:06
【问题描述】:
这是我的程序的示例代码。
我有一个名为function 的函数,它用于返回一个整数值和一个整数数组。我必须将它们作为指针传递(function 的签名不能更改)。所以我写了下面的代码。在这里,我必须将值分配给传递给函数的双指针。
void function(unsigned int* count, unsigned int ** array)
{
for(unsigned int i = 0; i<4;i++)
{
//array[i] = (unsigned int*)i*10;
}
*count = 4;
}
int main()
{
unsigned int count;
unsigned int array2[4];
function(&count, (unsigned int**)&array2);
return 0;
}
但是上面的代码不起作用。
【问题讨论】:
-
您的程序不会产生任何可观察到的输出。它怎么能证明你的问题?在某些时候,您必须对其进行测试以查看它是否有效。
-
我的主要需要是用指定的值填充函数'function'中的数组'array2'。我在VS中调试代码检查它是否正常工作。