This code:
rowSum(matrix,SIZE,row);
columnSum(matrix,SIZE,row);
should be:
rowSum(matrix,SIZE,row);
columnSum(matrix,SIZE,column);
So the column
array in your code has zero values for the rather mundane reason that you never initialised it.
What's more you are accessing beyond the end of the arrays here:
return row[i];
and here:
return column[j];
At both of these points i
and j
have values 4
. You would have avoided such a mistake had you declared the loop variables inside the for
statement. That would have limited the scope of these variables.
To fix the problem, return rowsum
and columnsum
respectively.
I do wonder what purpose the various SIZE
declarations serve since your hard code a value of 4 all over the place.