fork(3) download
  1. #include <cstddef>
  2. #include <cstdio>
  3.  
  4. template< size_t N >
  5. constexpr size_t length( char const (&)[N] )
  6. {
  7. return N-1;
  8. }
  9.  
  10. int main() {
  11.  
  12. char temp[256];
  13. sprintf(temp, "%s", "abc");
  14. static_assert( length(temp) == 3, "string length is not 3" );
  15.  
  16. // your code goes here
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:30: error: static assertion failed: string length is not 3
  static_assert( length(temp) == 3, "string length is not 3" );
                 ~~~~~~~~~~~~~^~~~
stdout
Standard output is empty