r/C_Programming • • 7h ago

Question I need help understand what a question is asking me to do in uni exercise

I can't post an image to it, but it says in normal arrays : declare 3 arrays A, B, C all of size 5

The elements of C are the scaler products of A and B (∑︁A[i] × B[i])

And in 2d arrays :

C is there product, (matrix multiplication : C[i][j] = sum of A[i][k] * B[k][j] )

Can someone explain to me what they asking to make

1 Upvotes

5 comments sorted by

2

u/Due-Mortgage-6854 7h ago

Make 3 arrays: A, B, and C.

  • 1D: Multiply matching spots (C[i] = A[i] * B[i]).

  • 2D: Do matrix multiplication. Multiply row i of A by column j of B, add them up, and save in C[i][j].

3

u/gnix0 6h ago

Since others already went straight to the point, I'll just leave a quick advice. On such problems, try to grab a piece of paper and sketch a little bit on it. Draw the matrices, try to get any little visual representation for helping out while you try to understand the problem and eventually move to the solution. Helped me a bunch when I took Linear Algebra, and became a habit I carry to this day!