int arr[2][6] = {{0,0,0,1,1,1},
{2,2,2,3,3,3}};
for(int row=0;row<2;row++)
{
for(int col=0;col<6;col++)
{
int temp[] = arr[row][col+4],arr[row][col+5],arr[row+1][col],arr[row+1][col+1];
for(int i=0;i<1;i++)
{
cout << temp[i] << endl;
//Replace 4 values in arr[] with values from temp[]
}
}
}
I'm trying to create a smaller temporary array to pull values from when updating the original 2D array. I'm getting an error with the line starting with int temp[]
. The error reads:
initialization with '{...}' expected for aggregate object
I'm not sure what's going wrong here, I am a beginner with C++.