fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void assert_failed(const char *file, int line, const char *func, const char *cond)
  5. {
  6. fprintf(stderr, "%s:%d: %s: Assertion `%s' failed.\n", file, line, func, cond);
  7. exit(1);
  8. }
  9.  
  10. #define ASSERT(X) if(!(X))assert_failed(__FILE__, __LINE__, __func__, #X);
  11.  
  12. int main()
  13. {
  14. #define MAX(a,b) ((a)>(b)?a:b)
  15. ASSERT(MAX(1,2)==1)
  16. }
Runtime error #stdin #stdout #stderr 0s 2288KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.c:15: main: Assertion `MAX(1,2)==1' failed.