mcalc

simple interactive program to perform matrix operations. (WIP)
Index Commits Files Refs README LICENSE
main.c (930B)
   1 #include "main.h"
   2 #include "matrix.h"
   3 #include "prompt.h"
   4 
   5 #include <limits.h>
   6 
   7 #define MATRIX_ID_MAX_LENGTH 25
   8 
   9 int main (void)
  10 {
  11     status_t st;
  12     static matrix_t **matrix_ids;
  13 
  14     /*    Only prints the main header    */
  15     prompt_welcome();
  16 
  17     /*    array to store the matrix entered on the program execution    */
  18     matrix_ids = (matrix_t **)calloc(MATRIX_IDS_ARRAY_LENGTH, sizeof(matrix_t));
  19     for(size_t i = 0; i < MATRIX_IDS_ARRAY_LENGTH; i++)
  20         matrix_ids[i] = (matrix_t *)calloc(MATRIX_ID_MAX_LENGTH, sizeof(matrix_t));
  21 
  22     /*    The main prompt ask for a matrix interactively and returns a pointer to it    with the values already initialized    */
  23     for(size_t i = 0;i < UINT_MAX;i++) {
  24         if((st = get_matrix(matrix_ids[i], matrix_ids)) != OK) {
  25             /*    Prompt what do you want to do with the matrix you entered?    */
  26             printf("%s", "What do you want to do with the matrix you entered?: ");
  27             return st;
  28         }
  29     }
  30     return 0;
  31 }