int *column_to_row(int **a, int rows, int column_index)
{
// a is a the matrix,rows are the number of rows in the matrix
//column_index is the chosen column of the matrix to be turned into a vector
int i;
int *b=malloc(rows*sizeof(int));// b will be my returned vector
if(b==NULL)
{
exit(EXIT_FAILURE);
}
for(i=0;i<rows;i++)
{
b[i]=a[i][column_index];
}
return b;
}
我一直得到这个C2040错误:
error C2040: 'column_to_row' : 'int *(int **,int,int,int)' differs in levels of indirection from 'int ()'
我做错了什么?
答案 0 :(得分:1)
该功能正常工作。
很可能会因为原型丢失而抱怨。
int *(int **,int,int,int)
看起来函数调用与声明不一致因为它应该是int*(int **, int ,int)