Skip to content

Instantly share code, notes, and snippets.

@hidsh
Created April 3, 2022 17:53
Show Gist options
  • Save hidsh/f5751b8cbb216d3879a9cb226ee13321 to your computer and use it in GitHub Desktop.
Save hidsh/f5751b8cbb216d3879a9cb226ee13321 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <assert.h>
int x = 10;
int main(void)
{
assert(x < 5);
printf("assert test\n");
return 0;
}
/*
❯❯❯ gcc assert-test.c && ./a.out
Assertion failed: (x < 5), function main, file assert-test.c, line 9.
[1] 3665 abort ./a.out
❯❯❯ gcc -DNDEBUG assert-test.c && ./a.out
assert test
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment