0

I m trying to make a function that checks if a matrix is lower triangular or not but I have a problem running it, it says n and int m are not declared

int lower_mat(int mat[n][m],int n, int m)
{
    int i, j;
    int count=0;
    if (n==m)
    {
        for ( i = 0; i <n; i++)
        {
            for ( j = 0; j < m; j++)
            {
                if( i < j )
                {

                    if (mat[i][j]!=0)
                    {

                        return -1;
                    }
                }


            }

        }
        return 0;
    }
}

joe souaid
  • 40
  • 6

1 Answers1

0

declaration of int m and int n should come first and then you should use them , you should say int lower_mat(int n, int m, int mat[n][m]) instead of int lower_mat(int mat[n][m],int n, int m).

hanie
  • 1,863
  • 3
  • 9
  • 19