Can there be 4d arrays? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 15

Can there be 4d arrays?

That is very strange to think of!!

23rd Feb 2017, 10:04 AM
Martim Baptista
Martim Baptista - avatar
64 Answers
+ 35
string str = {{{{"yes"}}}};
24th Feb 2017, 11:46 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 28
sure you can imagine it like this (just an example for representing something with 4D array): a city grid of buildings is the two dimensional portion of the array now, each building have a number of floors, which is the 3rd dimension and on each floor you have an array of strings for the tenants/appartments
23rd Feb 2017, 10:12 AM
Burey
Burey - avatar
+ 10
we actually had home assignment once to make a sim city like game in c or c++ (don't remember ;_;) where you made a grid like that for the city, had floors and tenants
23rd Feb 2017, 10:17 AM
Burey
Burey - avatar
+ 7
ya ya why not.. you can create as you want.... 4 or more than 4 d array..
25th Feb 2017, 6:32 PM
Ganga Prasad Gupta
Ganga Prasad Gupta - avatar
+ 5
ya ya why not. we can do it as you want.....
24th Feb 2017, 7:25 PM
Ganga Prasad Gupta
Ganga Prasad Gupta - avatar
+ 4
Yes there can be it is awkward practically but theoretically compiler can make 4 coordinate storage system. Thus arrays of 4d and above can be created. They are initialized just like 2d and 3d
23rd Feb 2017, 5:42 PM
AAYUSH NARWAY
AAYUSH NARWAY - avatar
+ 4
any numbers of dimensions is possible in array.
24th Feb 2017, 12:15 PM
saeed Fatemi
saeed Fatemi - avatar
+ 4
HELL YEAH!!...... YOU CAN
25th Feb 2017, 3:09 AM
Yash Raghava
Yash Raghava - avatar
+ 3
[x][x][x][x] // x array (first d) [y] // y is array that going from every x array [y] // So now its 2d [y] [y][z][z][z][z] // Every y contains z array (3d) _______[g] _______[g] // Every z contains g array (4d) _______[g]
24th Feb 2017, 11:56 PM
Эмиль Шабданбеков
Эмиль Шабданбеков - avatar
+ 3
yes
25th Feb 2017, 1:38 AM
Bruh
+ 3
👉 You can create as many multidimensional arrays as you want/need (unlimited).
25th Feb 2017, 9:02 PM
Ismail
Ismail - avatar
+ 3
I suppose, it's important to note, that the more dimensions in array we have, the slower our code works (because of the way C++ interacts with computer memory). So, of cause, you can. But think twice.
28th Feb 2017, 1:00 AM
Victoria Tokareva
Victoria Tokareva - avatar
+ 2
You can create any multidimensional array
23rd Feb 2017, 8:34 PM
Hermann Set
Hermann Set - avatar
+ 2
of course it is possible, don't think about it like a physicists
24th Feb 2017, 10:32 AM
hamid
+ 2
yes you can
24th Feb 2017, 11:34 AM
hitesh
hitesh - avatar
+ 2
yes
7th Mar 2017, 11:49 AM
Shiv Mishra🎸
Shiv Mishra🎸 - avatar
+ 1
Thank you!! That made it way easier to understand!!!!
23rd Feb 2017, 10:14 AM
Martim Baptista
Martim Baptista - avatar
+ 1
yes 4d arrays can be create.
24th Feb 2017, 6:24 AM
Anil Meena
Anil Meena - avatar
+ 1
yes, there can be array of any dimensions but generally we don't declare it as it is quite confusing.
24th Feb 2017, 12:12 PM
Paras jain
Paras jain - avatar
+ 1
You, in theory, are not limited to any number. Though you'll need a quantum computer when the numbers get too large as theory only helps so much.
24th Feb 2017, 2:48 PM
The Artist Formally Known as Jeremy
The Artist Formally Known as Jeremy - avatar