Can i used 3D array in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can i used 3D array in C++?

15th Aug 2019, 8:01 AM
yahya sh
yahya sh - avatar
6 Answers
+ 3
like that? int arr [3] [3] [2]; for (int i=0;i<3:i++) for (int j=0;j<3;j++) for (int k=0;k<2;k++) cin>>arr[i] [j] [k] ;
15th Aug 2019, 8:21 AM
yahya sh
yahya sh - avatar
+ 2
Yes you can do that. Your primary target to accomplish printing or working in 3D array is using for loops. Nesting your for loops.
15th Aug 2019, 8:12 AM
Franky BrainBox
Franky BrainBox - avatar
+ 2
yahya sh , you are correct with that but bear in mind that you need to initialize your arrays before working with it.
15th Aug 2019, 8:25 AM
Franky BrainBox
Franky BrainBox - avatar
+ 1
just i want to learn how can i do that? 😁 thanks
15th Aug 2019, 8:08 AM
yahya sh
yahya sh - avatar
+ 1
thanks my friend 🌹
15th Aug 2019, 8:25 AM
yahya sh
yahya sh - avatar
0
For example? int arr [3] [3] [2] ;
15th Aug 2019, 8:05 AM
yahya sh
yahya sh - avatar