fork(1) download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template < typename T, size_t N >
  5. constexpr size_t countof(T (&arr)[N])
  6. {
  7. return N;
  8. }
  9.  
  10. int main() {
  11. // your code goes here
  12. int array[10];
  13. int array2[countof(array)];
  14.  
  15. std::cout << countof(array) << std::endl;
  16. std::cout << sizeof array/sizeof array[0] << std::endl;
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
10
10