This is what I have for finding the minor. I think I could make it more condense to run faster but don't know what to do really. My program works with this function, but I'm just wondering what I can do to make it run smoother.

Code:

double minor(double A[][4], int i, int j)
{
double find_minor[3][3];
int counta = 0;
int countb = 0;
for (int x = 0; x < 4; x++)
{
if (x != j)
{
for (int y = 0; y < 4; y++)
{
if (y != i)
{
find_minor[counta][countb] = A[x][y];
++countb;
if (countb % 3 == 0)
{
countb = 0;
}
}
}
++counta;
}
}
double minordet = find_minor[0][0]*(find_minor[1][1]*find_minor[2][2]-find_minor[2][1]*find_minor[1][2]) -
find_minor[0][1]*(find_minor[1][0]*find_minor[2][2]-find_minor[2][0]*find_minor[1][2])+find_minor[0][2] *
(find_minor[1][0]*find_minor[2][1]-find_minor[2][0]*find_minor[1][1]);
return minordet;
}