# Thread: function that compares exact and inexact matches for two character arrays

1. ## function that compares exact and inexact matches for two character arrays

I'm writing a function that compares two different character arrays of 3 to 6 dimensions for exact and inexact matches. It returns the number of exact and inexact matches via output parameters.
For some reason I'm getting huge numbers for the matches, can you help me figure out what is wrong?
Code:
```int calcMatches(char answer[], int dim, Guess guess, int *exact, int *inexact)
{
int j, count = 0, decount = 0;
/*inexact matches algorithm*/
if(dim == 3)
{
*inexact = count + 1;                     /*first term*/
else if(answer[0] == guess.letters[2]) /*first term*/
*inexact = count + 1;                     /*first term*/

else if(answer[1] == guess.letters[0]) /*2nd term*/
*inexact = count+1;                    /*2nd term*/
else if(answer[1] == guess.letters[2]) /*2nd term*/
*inexact = count+1;                    /*2nd term*/

*inexact = count + 1;
*inexact = count+1;
}

if(dim == 4)
{
*inexact = count + 1;                    /*first term*/
*inexact = count + 1;                    /*first term*/
*inexact = count + 1;

*inexact = count + 1;                     /*2nd term*/
*inexact = count + 1;                     /*2nd term*/
*inexact = count + 1;

*inexact = count + 1;
*inexact = count + 1;
*inexact = count + 1;

for(j=0; j<(dim-1); j++)
*inexact = count + 1;
}

if(dim == 5)
{
for(j=1; j<dim; j++)
*inexact = count + 1;

*inexact = count + 1;
for(j=2; j<dim; j++)
*inexact = count + 1;

*inexact = count + 1;
*inexact = count + 1;
for(j=3; j<dim; j++)
*inexact = count + 1;

for(j=0; j<3; j++)
*inexact = count + 1;
*inexact = count + 1;

for(j=0; j<(4); j++)
*inexact = count + 1;
}

if(dim == 6)
{
for(j=1; j<dim; j++)
*inexact = count + 1;

*inexact = count + 1;
for(j=2; j<dim; j++)
*inexact = count + 1;

*inexact = count + 1;
*inexact = count + 1;
for(j=3; j<dim; j++)
*inexact = count + 1;

for(j=0; j<(3); j++)
*inexact = count + 1;
*inexact = count + 1;
*inexact = count + 1;

for(j=0; j<4; j++)
*inexact = count + 1;
*inexact = count + 1;

for(j=0; j<5; j++)
*inexact = count + 1;
}

/*exact matches algorithm*/
for(j=0; j<dim; j++){