Question
Write a C program that calls a function to add two matrices (matrix = two dimensional array). You decide on the size of the matrix
Write a "C" program that calls a function to add two matrices (matrix = two dimensional array).
You decide on the size of the matrix and the elements of the matrices.
The main program should create and populate the matrices with non-zero values. The function should perform a matrix addition and assign the result to another array. The function should be flexible enough to work with any array size and the sizes communicated to the function from the main function.
After the function call, the main program should print the array with the initial values followed by the result of the addition as shown below.
Initial values
3 1 2
7 8 9
6 5 1
3 4 5
Result
9 6 3
10 12 14
Use as many variables and arrays as needed.
Provide restriction so that the original array passed to it cannot be modified by the function.
Print using %2d to streamline the output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started