Reputation: 19
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;
}
I keep getting this C2040 Error:
error C2040: 'column_to_row' : 'int *(int **,int,int,int)' differs in levels of indirection from 'int ()'
What am I doing wrong?
Upvotes: 0
Views: 111
Reputation: 21
the function works correctly.
most likely it complains because the prototype is missing.
int *(int **,int,int,int)
looks like function call does not agree with declaration cause it should be int*(int **, int ,int)
Upvotes: 1