断言 assert

#define	_CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
int main()
{
	int *p = NULL;
	assert(p != NULL);
	if (p == NULL)//断言失败下面程序将不会被执行
	{
		printf("p == NULL\n");
		return;
	}
	system("pause");
}

// 如下为结果
在这里插入图片描述
在这里插入图片描述
断言是一个宏

猜你喜欢

转载自blog.csdn.net/belongHWL/article/details/91040821