hi guys, im doing a matrix addition using recursion. however it dosent seems to work.
Code:
//for (row=0; row<row_size; row++)
//for (col=0; col<col_size; col++)
//mtxC[row][col] = mtxA[row][col] + mtxB[row][col]; using of for loop
// using of recursion
for(counter ;counter<1; counter++)
{
store = col_size;
} //col_size is the maximum size of the column eg. mtxA[][col_size]
if(row_size==0 && col_size == 0)
{
mtxC[row_size][col_size] = mtxA[row_size][col_size] + mtxB[row_size][col_size];
return mtxC,mtxA,mtxB,row_size,col_size;
// if both row_size and col_size reaches 0 which means it has comes to the end of the program and return all the values back to the place where its being called.
}
else
{
mtxC[row_size][col_size] = mtxA[row_size][col_size] + mtxB[row_size][col_size];
if(row_size!=0 && col_size==0)
{
col_size=store;
row_size--;
col_size++;
}
return sumMatrix(mtxC,mtxA,mtxB,row_size,col_size-1);
}