我试图操纵一个动态分配矩阵,该矩阵被宣布为使用功能的全球指示器,为简单起见,我不打算在这里粘贴代码,但我会提供一个相当的,也许更清晰的示例。
structname **variable;
int main()
{
variable = readfile("filename");
variable = modify(variable);
output(variable);
}
这看起来很简单,输入和输出工作正确, 问题在于我的“ 修改” 功能没有做任何修改, 这是一个例子:
structname **modify(structname **p)
{
swapitems(p[x][y],p[j][z]);
modifyitem(p[x][y]);
return p;
}
与
void swapitems(structname a, structname b)
{
structname buffer;
buffer = b;
b = a;
a = buffer;
}
I guess the problem is that I can t pass the elements to swapitems
and modifyitem
like that, how can I modify items using functions like those in the modify
?
(of course there are no compiling errors )