Possible Duplicate:
How do I use arrays in C++?
I was having trouble copying an array to an array. I have a feeling it may be because of the use of pointers but correct me if I'm wrong.
My function is the following:
bool sodoku::rowTest(sodoku *arr[9][9])
{
int row = 0;
while(row < 9)
{
for(int j = 0; j < 9; j++)
{
for(int k = 0; k < 9; k++)
{
if(arr[row][j]->number == arr[row][j]->possibleNumbers[k])
{
for(int i = 0; i < 9; i++)
{
arr[row][i]->possibleNumbers[k] = 0;
}
}
for(int g = 0; g < 7; g++)
{
int t = 8;
arr[row][g]->possibleNumbers[k] = arr[row][t]->possibleNumbers[k];
}
cout << "arr row j num : " << arr[row][j]->possibleNumbers[k] << "row: " << row << " column: " << j << endl;
}
}
row++;
}
if(row == 9)
return true;
}
return true;
}
My little section of trouble is here:
for(int g = 0; g < 7; g++)
{
arr[row][g]->possibleNumbers[k] = arr[row][8]->possibleNumbers[k];
}
For some reason when I cout each element, the copying doesn't occur. Could anyone help me as to know why this would hhappen? I just want every array from arr[row][1]->possibleNumbers[k] to arr[row][7]->possibleNumbers[k] have the same values as arr[row][8]->possibleNumbers[k]. PossibleNumbers ranges from 0 to 9, if that helps.
If anyone could help that'd be great.
Thanks.