Vícerozměrná pole

{“https:\/\/www.jdoodle.com\/a\/96A?format=text”:”#include <iostream>\nusing namespace std;\n\nconst int rows = 2;\nconst int cols = 3;\n\nint array1[rows][cols] = {\n {1, 2, 3},\n {4, 5, 6}\n};\n\nint array2[rows][cols] = { 1, 2, 3, 4, 5, 6 };\n\nvoid printArray(int (*pArray)[cols]) {\n for(int row = 0; row < rows; row++) {\n for(int col = 0; col < cols; col++) {\n cout << pArray[row][col] << "; ";\n }\n cout << endl;\n }\n}\n\nint main() {\n printArray(array1);\n cout << endl;\n printArray(array2);\n \n return 0;\n}”,”https:\/\/www.jdoodle.com\/a\/96I?format=text”:”#include <iostream>\nusing namespace std;\n\nint array[3][3][3];\n\nint main() {\n \/\/ Z\u00e1pis hodnot\n array[1][1][2] = 5;\n array[2][0][2] = 10;\n \n \/\/ \u010cten\u00ed hodnot a z\u00e1pis na v\u00fdstup\n cout << array[1][1][2] << endl;\n cout << array[2][0][2] << endl;\n}”,”https:\/\/www.jdoodle.com\/a\/99C?format=text”:”#include <iostream>\nusing namespace std;\n\nconst int itemCount = 10;\n\nint array1[itemCount];\nint array2[itemCount][itemCount];\nint array3[itemCount][itemCount][itemCount];\n\nint main() {\n \/\/ Jednorozm\u011brn\u00e9 pole\n array1[1] = 20;\n cout << *(array1 + 1) << endl;\n \n \/\/ Dvourozm\u011brn\u00e9 pole\n array2[4][3] = 40;\n cout << *( *(array2 + 4) + 3) << endl;\n \n \/\/ Trojrozm\u011brn\u00e9 pole\n array3[5][2][7] = 60;\n cout << *( *( *(array3 + 5) + 2) + 7) << endl;\n}”}


Vícerozměrná pole
Ohodnoťte tento článek