#include <stdio.h>
#include <assert.h> // 诊断
/*
=========================================================
time: 2017年1月24日17:04:51
objective: test C language's head file of <assert.h>
version: Microsoft Visual C++
author: ChenFei
remark: 日文system 部分汉字需用拼音代替
=========================================================
*/
int main(void)
{
int a;
char str[50];
printf("Please enter a value.");
scanf("%d", &a);
assert(a >= 10); // assert(ture),程序继续执行
printf("Entered number is %d\n", a); // assert(false),程序跳出错误窗口,并打出错误信息。
printf("Please input string. ");
scanf("%s", &str);
assert(str != NULL);
printf("The input string is %s\n", str);
return 0;
}
C标准库学习之<assert.h> ——诊断
最新推荐文章于 2024-11-04 20:25:25 发布
