/**************************
 * Owen Sullivan
 * CPSC 2310 Fall 2022
 * Username: opsulli
 * Instructor: Dr. Yvon Feaster
**************************/

#include "functions.h"

int main(int argc, char **argv) {

    if (argc < 2) { 
        
        printf("Not enought arguments: ./exe filename\n"); 
        exit(-1);
    
    }

    FILE *fp = fopen(argv[1], "r");
    if (fp == NULL) {
        
        printf("fp did not open.\n"); 
        exit(-1);
    
    }

    int size = 0;
    int **mat = readFile(fp, &size);
    
    printMatrix(mat, size);

    // Print the output from a function call to calculateVal
    printf("Total = %d\n", calculateVal(mat, size));

    // Free matrix memory
    for (int row = 0; row < size; row++) {
        
        free(mat[row]);
    
    }
    free(mat);

    return 0;

}