I want to do matrix multiplication with variable sized arrays in C, however I can't initialize the matrix variable.
Here is the code:
printf("Enter dimensions of matrix A: ");
scanf("%d %d", &p, &q);
printf("Enter number of columns of matrix B: ");
scanf("%d", &r);
int A[p][q] = {{}};
int B[q][r] = {{}};
int C[p][r] = {{}};
I searched for similar queries online however, most deal with one dimensional arrays or two dimensional square arrays. What should I do?
{{0}}. For VLA, after declaration, you can usememset()to zero the array, e.g.memset (A, 0, sizeof A);