Efficient method to store a Lower Triangular Matrix using row-major mapping

#include
#include
  

const int N = 5;
  

struct Matrix {
    int* A;
    int size;
};
  

void Set(struct Matrix* mat,
         int i, int j, int x)
{
    if (i >= j)
        mat->A[i * (i – 1) / 2 + j – 1] = x;
}
  

int Get(struct Matrix mat, int i, int j)
{
    if (i >= j) {
        return mat.A[i * (i – 1) / 2 + j – 1];
    }
    else {
        return 0;
    }
}
  

void Display(struct Matrix mat)
{
    int i, j;
  
    
    for (i = 1; i