fork(1) download
  1. #include <iostream>
  2.  
  3. template <typename T>
  4. void print(const T&e)
  5. {
  6. std::cout << e << " ";
  7. }
  8.  
  9. template <typename T, std::size_t N>
  10. void print(const T (&a)[N])
  11. {
  12. std::cout << "{";
  13. for (const auto& e : a) {
  14. print(e);
  15. }
  16. std::cout << "}" << std::endl;
  17. }
  18.  
  19.  
  20. int main() {
  21. const int a[2][3][4] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
  22.  
  23. print(a);
  24. return 0;
  25. }
  26.  
  27.  
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
{{{0 1 2 3 }
{4 5 6 7 }
{8 9 10 11 }
}
{{12 13 14 15 }
{16 17 18 19 }
{20 21 22 23 }
}
}