How to use assertion in C

1 Answer

0 votes
#include <stdio.h>
#include <assert.h>

int main(void) {
   int n = -9;
   
   assert(n >= 0);
   
   printf("n = %d", n);
   
   return 0;
}
 
 
 
 
/*
run:
 
c:7: main: Assertion `n >= 0' failed.
Command terminated by signal 6
 
*/

 



answered Sep 23, 2021 by avibootz

Related questions

2 answers 293 views
2 answers 241 views
1 answer 333 views
6 answers 688 views
...