Relative Content

Tag Archive for arrayscmatrix

From 2D Arrays to 2×2 Matrix in C

I am trying to make a 2×2 matrix from two 2D arrays that contain values in C.The Matrix to be produced, named overlap and is a 2×2 matrix, has elements that are functions of each D and A Arrays.
I have written the following code and its output shown below.
I don’t know what I am doing wrong and was wondering if whoever reads this can help a misguided new C learner.
P.S. I know I can write each element explicitly then put them into a matrix without using an array; however, I plan to use this skeleton as a foundation for an automation caculcation code for bigger input.
Thank you all for your time and effort,
Moe

getting the wrong values in an array in C

I have to write a program that “compresses” a matrix if in 4 adjacent cells there is a 1 in each else 0 and then move the next square and so on and so on.
the 1’s and 0’s are filled in a different matrix.
now when I tried to debug the program let’s say I had this matrix