Help! Fix source code for rref-ing matrix

#define N 10
int i, j, k, R=5, C=5;
double hold[1][N], D, M;
#include <stdio.h>
int main (void)
{
double a[N][N]={{1,1,4,1,2},{0,1,2,1,1},{0,0,0,1,2},{1,-1,0,0,2},{2,1,6,0,1}};
void Print_Matrix (double[N][N]);
void I_Column(double [N][N], int);
Print_Matrix (a);
for (k=0; k<=R-1; k++)
{
I_Column (a, k);
printf("\n\nColumn %d is finished\n\n", k+1);
Print_Matrix (a);
}
return 0;
}

void I_Column (double a[N][N], int k)
{
D=a[k][k];
for (j=0; j<=C-1; j++)
a[k][j]/=D;

for (i=0; i<=R-1; i++)
{
M=-a[i][k];
for (j=0; j<=C-1; j++)
{
if (i!=k)
a[i][j]+=M*a[k][j];
}
}
return;
}
- Always put code in code tags for better understanding of the code.
- Always explain your problems clearly and what is the specific problem you are facing. No one want to do a guessing work.
Topic archived. No new replies allowed.