C-Kurs/Matrizenmultiplikation
< C-Kurs(Weitergeleitet von Ckurs/Matrizenmultiplikation)
Aufgabe
Schreibe eine Funktion mult die zwei beliebig große (aber zueinander passende) Matrizen miteinander mulipliziert.
Der Prototyp der Funktion mult soll sein:
void mult(
const int * const *a,
const int * const *b,
int * const *result,
int rows_a,
int cols_a,
int cols_b);
Verdeutliche dir zuerst, welches const welche Wirkung hat, und
Zum Testen kannst du folgende drei Arrays benutzen:
const int a0[] = {1, 0};
const int a1[] = {4, 3};
const int a2[] = {2, 5};
const int *a[] = {a0, a1, a2};
const int b0[] = {6, 3, 4, 2};
const int b1[] = {7, 1, 0, 5};
const int *b[] = {b0, b1};
int c0[4], c1[4], c2[4];
int * const result[] = {c0, c1, c2};
Ein viertes Array expected zum Vergleichen der Ergebnisse fehlt aber noch...
Tipp: Die Lösung enthält die Zahlen 15 und 16 in der Mitte.
Viel Spaß und Erfolg!