/* This is an example of the main program for project 2 phase 1. You can modity it, e.g. adding function calls to the function(s) you define in sparse.c. In this version, command line safety check is done data structure (ROOT **M) is defined to store input void read_input(FILE *F, ROOT *M, FILE *G) // read in matrix from input file F, build a listed list // with ROOT M, and print out the memory location of F // and M as well as the number of non-zero entries in M // on the screen and to the output file G void show_list (ROOT *M, FILE *F) // print values in a listed list with ROOT M on the // screen and to the output file F The p2.c that will be used to grade your project will be posted later. You CANNOT make any changes to that file. Gang Qu March 31, 2026 */ #include #include #include "sparse.h" // include the header file int main(int argc, char *argv[]) { FILE *in, *out; ROOT **M; int i, j, k; if (argc < 2) { printf("Usage: a.out input1 input2 ... output\n"); exit(0); } M = (ROOT **) malloc((argc-1)*sizeof(ROOT *)); if (M == NULL) exit(0); out = fopen(argv[argc-1], "w"); if (out == NULL) { printf("output file %s cannot open ...\n", argv[argc-1]); exit(0); } for (i=1; i