Hi.
I didn't declare a,b,c from the first program but i did after the first program. What am i missing?
#define m 2
#define n 2
void matrixaddition()
{
int i,j;
for (i=0; i<m; i++)
for (j=0; j<n; j++)
c[i] [j] = a[i] [j] + b[i] [j];
}
#include <stdio.h>
int a[m][n] = {1,1,1,1};
int b[m][n] = {2,2,2,2};
int c[m][n] ;
void printc ()
{
int i, j;
for(i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
printf("%d ", c[i] [j]);
printf("\n");
}
}
int main ( )
{
matrixaddition();
printc() ;
getchar();
}