Hey guys, I think I have a pretty simple fix here, I just need somebody to point out my error.
I'm getting a seg fault after writing to an array of char. I need my function to run through the array and find pairs. If every char in the array has a pair, return true. After my program acepts values into the array, it segfaults. Heres my code...
bool allValuesArePaired(char d[], int o) //int o is equal to const int (EVEN = 6)
{
int count, tracker, i, j;
cout << "Fill array to check parity\n";
for (i = 0; i < EVEN; i++)
{
d[i] = 0;
cin >> d[i];
}
for (i = 0; i < EVEN; i++)
{
for (j = 0; i < EVEN; j++)
{
if (d[i] == d[j])
{
count++;
cout << count;
}
if (count == 2)
{
count = 0;
tracker++;
}
}
}
if (tracker >= EVEN / 2)
{
return true;
}
else
{
return false;
}
}