Question
struct Element { int value; int row; int column; struct Element *rowElement; struct Element *columnElement; }; struct Header { int index; struct Header *header; struct
struct Element {
int value;
int row;
int column;
struct Element *rowElement;
struct Element *columnElement;
};
struct Header {
int index;
struct Header *header;
struct Element *element;
};
struct Matrix {
struct Header *headRowHeader;
struct Header *headColumnHeader;
int rows;
int columns;
int fillValue;
};
struct Matrix MTRX_alloc(char *filename, int fillValue); //need help solving this
void MTRX_free(struct Matrix* m); //need help solving this
int MTRX_getElement(struct Matrix *m, int row, int column); //need help solving this
void MTRX_write(struct Matrix *m, char *filename); //need help solving this
struct Matrix MTRX_add(struct Matrix *a, struct Matrix *b, int fillValue); //need help solving this
struct Matrix MTRX_multiply(struct Matrix *a, struct Matrix *b, int fillValue); //need help solving this
struct Matrix MTRX_transpose(struct Matrix *m); //need help solving this
int main() {
struct Matrix a, t;
a = MTRX_alloc("matrixA.txt", 0);
t = MTRX_transpose(&a);
MTRX_write(&t, "matrixT.txt");
MTRX_free(&t);
MTRX_free(&a);
return 0;
}
###########
matrixT.txt:
0 0 4 0 0 0 0 0 0 0 0 2 0 0 8 0 9 0 0 4 0 0 0 0
#########
matrixA.txt:
0 0 0 0 9 0 0 0 0 0 0 0 4 0 0 8 0 0 0 0 2 0 4 0
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