I have to find the maximum path sum from top to bottom until I reach the 
last row of the matrix.

I have to use a recursive function that returns the maximum sum. While going down we can only move one row down and one column to the right or left or straight down. My code is only returning the first index of the matrix. Is my logic and also the parameters that I have used for my function correct?

```c
    int mat[3][3], i, j;

    printf("Enter the elements of the matrix :\n");

    for (i = 0; i < 3; i++) {
        for (j = 0; j < 3; j++) {
            scanf("%d", &mat[i][j]);
        }
    }

    printf("%d", MaximumPath(mat, 0, 0));
}

int MaximumPath(int Mat[][N], int i, int j) {
    // IF we reached to first row of 
    // matrix then return value of that 
    // element  
    if (i == 0 && j = 0)
        return Mat[i][j]

    // out of matrix bound 
    if (i = N || j < 0)
        return 0;

    // call all rest position that we reached
    // from current position and find maximum 
    // between them and add current value in 
    // that path 
    return max(MaximumPath(Mat, i - 1, j), 
               MaximumPath(Mat, i - 1, j - 1), 
               MaximumPath(Mat, i - 1, j + 1)))
               + Mat[i][j];
}

int max(int i, int j, int k) {
    if ((i > j) && (i > k)) {
        return i;
    } else
    if ((j > i) && (j > k)) {
        return j;
    } else
    if ((k > i) && (k > j)) {
        return k;
    }
}

```