#include <cstddef>#include <cstdio> template< size_t N >constexpr size_t length( char const (&)[N] ){ return N-1;} int main() { char temp[256]; sprintf(temp, "%s", "abc"); static_assert( length(temp) == 3, "string length is not 3" ); // your code goes here return 0;}
Standard input is empty
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" ); ~~~~~~~~~~~~~^~~~
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!