2. Write a program to obtain the sum of two 2 d arrays (i.e. for, matrices). You will ask the user to input the size of the matrices as well as the matrices. Use Pointers in the program.
Write a two two-dimensional arrays, and the program, for the users to input the array size and number, and used in the program pointer
Below is I wrote, you don't know how to write the
#include
Void sum (int * (a) [c], int * (b) [d], int, c int d, int e, int f)
{
Int c, d, e, f;
Int sum1=0;
Int sum2=0;
For (c=0; C
}
}
For (d=0; D
}
}
Printf (" the sum total is in % d ", sum1 + sum2);
}
Int main ()
{
Int j, k, l, m;
Printf (" both please input the size of the array a [] [] in two dimentions: \ n ");
The scanf (" % d % d ", & amp; J., & amp; K);
Printf (" both please input the size of the array b [] [] in two dimentions: \ n ");
The scanf (" % d % d ", & amp; L, & amp; M);
Int I, h;
Int a [j] [k];
Int b [l] [m].
for(i=0; i
The scanf (" % d ", a [I] [h]);
}
}
Int o, p;
For (o=0; O
}
}
The sum (* a * b, j, k, l, m);
return 0;
}
CodePudding user response:
https://www.cnblogs.com/gmengshuai/p/13976038.html