multi 655 B

123456789101112131415161718192021222324252627
  1. int** multiArray(int width, int height) {
  2. int** array = new int*[width];
  3. for(int x = 0; x < length(array); x++) {
  4. array[x] = new int[height];
  5. for(int y = 0; y < length(array[x]); y++) {
  6. array[x][y] = y + x * height;
  7. }
  8. }
  9. return array;
  10. }
  11. void deleteMultiArray(int** array) {
  12. for(int x = 0; x < length(array); x++) {
  13. delete array[x];
  14. }
  15. delete array;
  16. }
  17. void main() {
  18. int** array = multiArray(2, 3);
  19. for(int x = 0; x < length(array); x++) {
  20. for(int y = 0; y < length(array[x]); y++) {
  21. test(array[x][y]);
  22. }
  23. }
  24. deleteMultiArray(array);
  25. }