fork(1) download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int width = 4, height = 4, depth = 4;
  6.  
  7. int arr[width * height * depth];
  8.  
  9. for (int i = 0, l = 0; i < depth; ++i)
  10. {
  11. for (int j = 0; j < height; ++j)
  12. {
  13. for (int k = 0; k < width; ++k)
  14. {
  15. arr[k + width * (j + depth * i)] = l++;
  16. }
  17. }
  18. }
  19.  
  20. for (int i = 0; i < depth; ++i)
  21. {
  22. for (int j = 0; j < height; ++j)
  23. {
  24. for (int k = 0; k < width; ++k)
  25. {
  26. int** ptr = reinterpret_cast<int**>(&arr[0] + width * (j + depth * i));
  27. std::cout<<ptr[j][k];
  28. }
  29. }
  30. }
  31.  
  32. return 0;
  33. }
Runtime error #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty