定义数据类型boolean
/*
* os = Linux openeuler 4.19.90-2106.3.0.0095.oe1.x86_64
* gcc_version = gcc version 7.3.0 (GCC)
* file_name = asserth.c
* gcc -o asserth asserth.c
*
*/
#include <stdio.h>
#include <assert.h>
// 定义boolean数据类型
typedef enum _bool
{
zero=0, one=1
} boolean;
// 定义boolean变量:"true"和"false"
boolean true = one;
boolean false = zero;
void print_number(int* myint)
{
assert(myint != NULL);
printf("myint = %d\n", *myint);
}
// 检查输入数据的关系
boolean check_expr(int in1, int in2)
{
assert(in1 >= in2);
return true;
}
void msg(int f1, int f2)
{ check_expr(f1, f2);
printf("%d >= %d .\n", f1, f2);
}
// test function
int main(int argc, char** argv)
{
int f1 = 30, f2 = 15;
msg(f1, f2);
int fn = 10;
int* b = NULL;
int* c = NULL;
b = &fn;
print_number(b);
print_number(c);
return 0;
}