fork(1) download
  1. #include <iostream>
  2.  
  3. template <typename T, int N>
  4. char (&ArraySizeHelper(T (&array)[N]))[N];
  5. #define NELEMS(x) (sizeof(ArraySizeHelper(x)))
  6.  
  7. int main()
  8. {
  9. int ar[10];
  10. std::cout << NELEMS(ar) << '\n';
  11. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
10