需要 #include <stdio.h>。判断表达式是不是为正也就是1.
直接上代码:
#include <stdio.h>
#include <assert.h>
int main() {
assert(1 != 2);
assert(1);
assert(!0);
int *p = NULL;
if (p) {
printf("true\n");
} else {
printf("false\n");
}
assert(p==NULL);
int a = 1;
p = &a;
assert(p!=NULL);
printf("end\n");
return 0;
}