Hi,
I want to change below code into a 3D array which the indexes are from -1 to 2.
I mean, I want change below code to create this:
A[-1][-1][-1] A[-1][-1][0] A[-1][-1][1] A[-1][-1][2]
A[-1][0][-1] A[-1][0][0] A[-1][0][1] A[-1][0][2]
A[-1][1][-1] A[-1][1][0] A[-1][1][1] A[-1][1][2]
A[-1][2][-1] A[-1][2][0] A[-1][2][1] A[-1][2][2]
A[0][-1][-1] A[0][-1][0] A[0][-1][1] A[0][-1][2]
A[0][0][-1] A[0][0][0] A[0][0][1] A[0][0][2]
A[0][1][-1] A[0][1][0] A[0][1][1] A[0][1][2]
A[0][2][-1] A[0][2][0] A[0][2][1] A[0][2][2]
A[1][-1][-1] A[1][-1][0] A[1][-1][1] A[1][-1][2]
A[1][0][-1] A[1][0][0] A[1][0][1] A[1][0][2]
A[1][1][-1] A[1][1][0] A[1][1][1] A[1][1][2]
A[1][2][-1] A[1][2][0] A[1][2][1] A[1][2][2]
would you please help me to change the below code and write the correct one?
-------------------------------------------------------------
1 2 3 4 5 6 7 8 9 10 11 12 13
|
//2D array
int **A;
A = new int*[4];
for (int i=0; i < 4; i++)
A[i] = new int[4];
// A is a 2D array which its indexs are:
// A[0][0] A[1][0] A[2][0] A[3][0]
// A[0][1] A[1][1] A[2][1] A[3][1]
// A[0][2] A[1][2] A[2][2] A[3][2]
// A[0][3] A[1][3] A[2][3] A[3][3]
| |