我试图做一个克拉默线性解决了,我写了替代矩阵列的功能,就像这样:如何返回矩阵?
void replacecol(int c, int n, float mat_in[n][n], float vect_in[n],
float mat_out[n][n])
{
int i, j;
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
if (j == c)
{
mat_out[i][j] = vect_in[j];
}
else
{
mat_out[i][j] = mat_in[i][j];
}
}
}
}
但它目前是无效的,而且我希望它返回mat_out与它的值,当我调用这个函数...我怎么能这样做?
你为什么要退货?你需要从中获得什么? – StoryTeller
你不能用C返回数组。函数已经正确设置了 –
好吧,你不能返回数组/矩阵,但你可以返回指针。 – LPs