Proj#3 - main.c */ #include<stdio.h>...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
main.c ******************************************************************/ #include<stdio.h> #include<stdlib.h> #include"matrix_functions.h" int main(void) { char com[2]; int cnt; int **matrices=NULL; int *row=NULL,*column=NULL; matrices=matrix_allocate_variable(4); row=matrix_allocate_variable(4); column=matrix_allocate_variable(4); printf(">>"); scanf("%s",&com); while(com[0]!='$') { cnt=(int)com[0]-65; matrix_new(matrices,row,column,com[0]); else if(com[0]=='+') matrix_add(matrices,row,column); else if(com[0]=='*') matrix_multiply(matrices,row,column); else if(com[0]=='^') matrix_transpose(matrices,row,column); else { fprintf(stderr,"ERROR: INVALID COMMAND.\n\n"); exit(1); } printf(">>"); scanf("%s",&com); } printf("END.\n\n"); return(0); } matrix_functions.h #ifndef _matrix_functions_h #define _matrix_functions_h
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
/*********************************************************************** Dynamic Matrix Operations Standard Header File "matrix_function.h" ***********************************************************************/ /*The maximum number of rows/columns supported.*/ #define MAX_MATRICES 5 /*Allocate space for an object of size "size" bytes and return a pointer to it. Exit with an error message if this allocation request cannot be granted.*/ void *matrix_allocate_variable(int size);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Proj#3 - main.c */ #include&lt;stdio.h&gt;...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online