I made the following function for my Sudoku solver but the answers keep turning out wrong (some of the numbers are showing as doubles right next to eachother). Can somebody help please?

```
void reduction_candidateLines(void)
{
/*
* declarations
*/
//drives loop
int k, j, x, y, z, t;
//counts the number of possibilities. also used to keep track of array location
int possibility_count;
//keeps track of indexes
int index1, index2;
//contains most recent index that is true
int value;
//location of this true possibility
int location[9];
int xLoc[9];
int jLoc[9];
int yLoc[9];
//row or column affected by square's contents
int row, column;
//y is cube shifter(each cube is the same index value + n * 3 away)
for(y = 0; y < 21; ++y)
{
if(y >= 0 && y < 3 || y >= 9 && y < 12 || y >= 18 && y < 21)
{
//k is possibility
for(k = 1; k < 10; ++k)
{
possibility_count = 0;
jLoc[2] = 6;
xLoc[2] = 6;
location[2] = 0;
//each cube uses 1, 2, 3 + n * 9
for(x = 1; x < 4; ++x)
{
for(j = 0; j < 3; ++j)
{
if(sudoku_possibilities[x + 9 * j + 3 * y][k] == true)
{
value = k;
location[possibility_count] = x + 9 * j + 3 * y;
xLoc[possibility_count] = x;
jLoc[possibility_count] = j;
yLoc[possibility_count] = y;
++possibility_count;
}
}
}
//rule only possible if 3 or 2 possibilities
if(possibility_count == 2 || possibility_count == 3)
{
if(jLoc[0] == jLoc[1] && jLoc[1] == jLoc[2])
{
index1 = 0;
index2 = 1;
}
else if(jLoc[0] == jLoc[1])
{
index1 = 0;
index2 = 1;
location[2] = 0;
}
else if(jLoc[0] == jLoc[2])
{
index1 = 0;
index2 = 2;
location[1] = 0;
}
else if(jLoc[1] == jLoc[2])
{
index1 = 1;
index2 = 2;
location[0] = 0;
}
else if(xLoc[0] == xLoc[1] && xLoc[1] == xLoc[2])
{
index1 = 1;
index2 = 2;
}
else if(xLoc[0] == xLoc[1])
{
index1 = 0;
index2 = 1;
location[2] = 0;
}
else if(xLoc[0] == xLoc[2])
{
index1 = 0;
index2 = 2;
location[1] = 0;
}
else if(xLoc[1] == xLoc[2])
{
index1 = 1;
index2 = 2;
location[0] = 0;
}
if(jLoc[index1] == jLoc[index2])
{
if(yLoc[index1] < 3)
{
row = jLoc[index1] + 1;
}
else if(yLoc[index1] < 12)
{
row = jLoc[index1] + 4;
}
else//yLoc[index1] must be < 21
{
row = jLoc[index1] + 7;
}
for(t = 1; t < 10; ++t)
{
if((row - 1) * 9 + t != location[0] && (row - 1) * 9 + t != location[1] && (row - 1) * 9 + t != location[2])
{
sudoku_possibilities[(row - 1) * 9 + t][value] = false;
}
}
}
/*else if(xLoc[index1] == xLoc[index2])
{
if(yLoc[index1] < 3)
{
column = jLoc[index1] + 1;
}
else if(yLoc[index1] < 12)
{
column = jLoc[index1] + 4;
}
else//yLoc[index1] must be < 21
{
column = jLoc[index1] + 7;
}
for(t = 1; t < 10; ++t)
{
if((t - 1) * 9 + column != location[0] && (t - 1) * 9 + column != location[1] && (t - 1) * 9 + column != location[2])
{
sudoku_possibilities[(t - 1) * 9 + column][value] = false;
}
}
}*/
}
}
}
}
}
```