fork download
  1. #include <iostream>
  2.  
  3.  
  4.  
  5. template <typename T, int N>
  6.  
  7. void array_size(T (&a)[N])
  8.  
  9. {
  10.  
  11. std::cout << N << "\n";
  12.  
  13. }
  14.  
  15. int main()
  16.  
  17. {
  18.  
  19. array_size("hello");
  20.  
  21. char bytes[16];
  22.  
  23. array_size(bytes);
  24.  
  25. return 0;
  26.  
  27. }
  28.  
  29.  
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
6
16