Can someone please explain how you call upon and list 3 and 4 dimensional arrays? The book isn't explaining very well and I'm stuck. I've done some google searches on it but there isn't anything there for a dumb person.
Printable View
Can someone please explain how you call upon and list 3 and 4 dimensional arrays? The book isn't explaining very well and I'm stuck. I've done some google searches on it but there isn't anything there for a dumb person.
Code:#include<iostream>
using namespace std;
int main()
{
int my_array[2][3][4];
for(int i=0; i<2; i++)
{
for(int j=0; j<3; j++)
{
for(int k=0; k<4; k++)
my_array[i][j][k]=i+j+k;
}
}
for(int x=0; x<2; x++)
{
for(int y=0; y<3; y++)
{
for(int z=0; z<4; z++)
cout<<my_array[x][y][z]<<" ";
cout<<endl;
}
cout<<endl<<endl;
}
return 0;
}
Don't quite understand your question.
Do you mean declare a 3 or 4 dimensional array?:
int ArrayName[10][10][10]; // declare a 3d array with the dimensions 10, 10, 10.
Or, how to use a array list as a call parameter?:
FunctionName(ArrayName[0][0]); // Give a pointer to the 3rd dimension with the dimensions 0, 0
Well I meant declareing them and calling on them