fork download
  1. #include <iostream>
  2. #include <typeinfo>
  3.  
  4. template <typename T, int Rows , int Columns>
  5. void info( T (&array)[Rows][Columns] )
  6. {
  7. std::cout << "Array Type: " << typeid(T).name() << std::endl;
  8. std::cout << "Array Size: " << Rows << 'x' << Columns << std::endl;
  9. }
  10.  
  11. int main()
  12. {
  13. int array1[32][1];
  14. float array2[12][5];
  15. double array3[7][123];
  16.  
  17. info(array1);
  18. info(array2);
  19. info(array3);
  20. return 0;
  21. }
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
Array Type: i
Array Size: 32x1
Array Type: f
Array Size: 12x5
Array Type: d
Array Size: 7x123