+ 2

How to make a matrix

to make a 3*3 matrix using C++

25th Aug 2017, 12:47 PM
Rayees Ali K
3 odpowiedzi
+ 5
3D array format: datatype name [ Max Row ] [ Max Column ] [ Max Height ]; example: int arr[ 2 ][ 3 ][ 4 ]= { { {1, 2, 3, 4}, {5, 6, 7, 8}, {9,10, 11, 12} }, { {13,14,15,16}, {17,18, 19, 20}, {21,22,23,24} } }; arr[0][0][0]; // 1 arr[0][0][1]; // 2 arr[0][0][2]; // 3 arr[0][0][3]; // 4 arr[0][1][0]; // 5 arr[0][1][1]; // 6 arr[0][1][2]; // 7 arr[0][1][3]; // 8 arr[0][2][0]; // 9 arr[0][2][1]; // 10 arr[0][2][2]; // 11 arr[0][2][3]; // 12 arr[1][0][0]; // 13 arr[1][0][1]; // 14 ....
25th Aug 2017, 1:45 PM
Babak
Babak - avatar
+ 3
type arrayName [ x ][ y ][ z ];
25th Aug 2017, 12:54 PM
AgentSmith
0
Datatype ArrayName [3][3]; e.i of int type:- int mat[3][3];
25th Aug 2017, 12:58 PM
GeekyShacklebolt
GeekyShacklebolt - avatar