0
Can sm explain me 3D array and 4D array?
17 odpowiedzi
+ 1
What do you mean
+ 1
That code is private, and you should do it like this:
int arr3d[][][]
instead of:
int[][][] arr3d
I'm sorry, but I get all the languages mixed up sometimes
+ 1
If you want that many elements, yes
0
Well, first you should understand 1D and 2D arrays.
A 1 dimensional array is just a normal array (like int[] arr1d).
A 2 dimensional array is an array, containing another array:
[1, 2, [3, 4, 5]]
You should declare it like this:
int[][] arr2d.
You can access its elements like this:
cout << arr2d[2][2]; //Outputs 4
More than two dimensional arrays don't need explanation, it's pretty obvious after that.
3D: int[][][] arr3d = [1, [2, [3, 4, 5]]];
arr3d[1][1][2] == 5
...
0
I'm sorry, are you sure that declared correctly?
0
Is it like that
int arr [2][2]={{1,2},/*0 row*/
{3,4}};/*1row*/
cout << arr [2][2];
// Outputs 0
0
Okay, I used brackets instead of curly brackets, but you get the point
0
Not fully
0
I do know 2d arr very well, but 3d and 4D is little bit complex for me
0
Anyway thxs for explanation
0
Btw Airree u explained me incorrectly
0
Look at my codes .There s code "3D array". Maybe through that you will see your mistake
0
Ok
0
You mean that I should declare like this:
int [2][3][4] arr3D
0
?
0
Got.
0
Let me just understand better through the coding