+ 1

array third parameter

In a array delclaration a[][][] in which third square brackets what represents?

3rd Jan 2019, 12:13 PM
Solairaj S
Solairaj S - avatar
3 Réponses
+ 10
In simple words, 1d array represent array of elements of a type like int,String etc. 2d array represent array of 1d array (having elements as 1d array) 3d array represent array of 2d array (having elements as 2d array).
4th Jan 2019, 5:07 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 3
See a [][][] is a 3D array The three square brackets are represented as it is a 3D array. So if you want to make a 1D array which will have a declaration like this : int a [4] = {1,2,3,4}; //you can use any data type you want If you are making 2D array : int a [2][5] = { {1,2,3,4,5}, {6,7,8,9,0} }; You can think of 2D array as like multiple 1D array And the 3D array will be like : int a [2][3][4] = { { {1,2,78,23}, {3,4,76,97}, {35,46,96,34} }, { {23,84,46,12}, {37,34,97,34}, {86,34,87,22} }, }; As you can see the more you increase the square brackets the dimensions will be also increased.
3rd Jan 2019, 12:54 PM
Sahil Bhakat
Sahil Bhakat - avatar
+ 3
Everything at first is a 1 D array... a 1 D array with elements of certain type like int char float double pointers etc...are conventional 1 D array a 1 D array with elements that are a 1 D array is a conventional 2 D array a 1 D array with elements that are a 2 D array is a conventional 3 D array.. a 1 D array with elements that are a n D array is a conventional (n+1) D array ......goes on and on... but at first and in basic array composition also.. everything is a 1 D array...nothing more
4th Jan 2019, 4:57 AM
sayan chandra
sayan chandra - avatar