fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. template<typename T, size_t N>
  6. constexpr size_t size_of(T (&)[N])
  7. { return N; }
  8.  
  9. int main() {
  10. char text[] = "Hello World!";
  11. cout << size_of(text) << " " << strlen(text);
  12. return 0;
  13. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
13 12