C program to calculate the determinant of a NxN matrix
<p>I'm trying to write a program that would calculate the determinant for me, and this is what I've done so far. But it's not working it just prints 6356918 for every matrix I throw at it. I've even compared my code to some other codes on the internet but that didn't work.</p>

<p>And I don't know anything about pointers so I cannot use them. I tried debugging which I don't know much about it either, but there seems to be something wrong with the first 'if' in the second function and the last part of the code which calculates the determinant. I'm coding in code::blocks.</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;conio.h&gt;

main()
{
    int A[100][100];
    int i,j,k,n,res;
    printf("Enter the order of the matrix: \n");
    scanf("%d",&amp;n);
    printf("\nEnter the elements of the matrix one by one: \n");
    for(i = 0 ; i &lt; n ; i++)
    {
        for(j = 0 ; j &lt; n ; j++)
        {
            scanf("%d",&amp;A[i][j]);
        }
    }
    for(i = 0 ; i &lt; n ; i++)
    {
        for(j = 0 ; j &lt; n ; j++)
        {
            printf("%5d",A[i][j]);
        }
        printf("\n");
    }
    res = det(A,n);
    printf("%d",res);
}
int det(int A[100][100], int n)
{
    int Minor[100][100];
    int i,j,k,c1,c2;
    int determinant;
    int c[100];
    int O=1;

    if(n == 2)
    {
        determinant = 0;
        determinant = A[0][0]*A[1][1]-A[0][1]*A[1][0];
        return determinant;
    }
    else
    {
        for(i = 0 ; i &lt; n ; i++)
        {
            c1 = 0, c2 = 0;
            for(j = 0 ; j &lt; n ; j++)
            {
                for(k = 0 ; k &lt; n ; k++)
                {
                    if(j != 0 &amp;&amp; k != i)
                    {
                        Minor[c1][c2] = A[j][k];
                        c2++;
                        if(c2&gt;n-2)
                        {
                            c1++;
                            c2=0;
                        }
                    }
                }
            }
            determinant = determinant + O*(A[0][i]*det(Minor,n-1));
            O=-1*O;
        }
    }
    return determinant;
}
</code></pre>