#define OK 1 #define ERROR 0 #define OVERFLOW -2这些定义有什么作用

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/30 22:44:57

#define OK 1 #define ERROR 0 #define OVERFLOW -2这些定义有什么作用
#define OK 1 #define ERROR 0 #define OVERFLOW -2这些定义有什么作用

#define OK 1 #define ERROR 0 #define OVERFLOW -2这些定义有什么作用
使程序方便阅读,同时编写起来也方便.
这三个宏一般用在子程序,子模块返回的三个状态.用 1 0 -2 三个数来表示.
程序中只是写三个数的话,阅读时不太明白三个数的意义,需要深入程序中去了解.当时了解了,记住了,过后可能又会忘记.写成这样,不用了解具体是几,只知道是这个状态.
自己写程序,有时也会忘记自己给这几个状态当时定义了是几,所以用宏代替你的好记性.

#define OK 1 #define ERROR 0 #define OVERFLOW -2这些定义有什么作用 #define TURE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW #define TURE 1#define FALSE 0#define OK 1#define ERROR 0#define INFEASIBLE -1#define OVERFLOW -2typedef int status;typedef int ElemType;#include#define #include #include #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #d能不能帮改下程序 #define 括号匹配检验程序#include#include#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0typedef char SElemType;typedef int Status;#define STACK_INIT_SIZE 100#define STACKINCREMENT 10typedef struct{SElemType *base;SElemType *top;int stacksize; warning C4700:local variable 'l' used without having been initialized#include stdio.h#include stdlib.h#define ERROR 0#define ok 1#define OVERFLOW -2#define list_init_size 100//线性表存储空间的初始分配量#define listincrement 10//线 一道数据结构题:#include #include #define STACK_INIT_SIZE 100#define STACKINCREMENT 10#define OK 1#define ERROR 0typedef struct{int *base;int *top;int stacksize;}SqStack;int InitStack(SqStack *S){S->base=(int *)malloc(STACK_INIT_SIZE*sizeof(i 我有一个关于约瑟夫问题的程序,但是不懂,包括变量的含义和语句实现的功能这是第一个程序#includeusing namespace std;#define TRUE 1#define FALSE 0#define OK 1typedef int Status;typedef double ElemType;//-------------- define是什么意思 请帮我找出程序错误的地方#includeusing namespace std;#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0typedef char ElemType;typedef int Status;typedef struct LNode{ElemType data;struct LNode *next;}LNode,*LinkList;void CreatList_L(L #define N 2 #define M N+1 #define K M+1*M/2#define N 2#define M N+1#define K M+1*M/2main(){int i;for(i=1;i #define什么意思#define ENABLE_SYNC0_INT {(_INT3IE) = 1;} //enableinterrupt source INT3#define ACK_SYNC0_INT {(SYNC0_INT_REQ) = 0;}#define SET_SYNC0_INT {(SYNC0_INT_REQ) = 1;}#define SYNC0_INT_PORT_IS_ACTIVE {(INT_EL) == 0;}#define INIT_SYNC1_INT #define 后面的意思// macros for accessing triangle corners#define TIN_TRIANGLE(i) (i/3)#define TIN_CORNER(i) (i%3)#define TIN_INDEX(t,c) (t*3+c)#define TIN_NEXT(c) ((c+1)%3)#define TIN_PREV(c) ((c+2)%3) 计算机组成原理习题求解1 Briefly define immediate addressing.2 Briefly define direct addressing.3 Briefly define indirect addressing.4 Briefly define register addressing.5 Briefly define register indirectaddressing.6 Briefly define displace #define SETBIT(x,y) (x|=(1 #define BIT_SET(var,bit) ((var) |= (1 #define getbit( b,n) (((b) & (1L 一段c语言代码,第三行开始就看不懂了#define bwMCDR2_ADDRESS 4#define bsMCDR2_ADDRESS 17#define bmMCDR2_ADDRESS BIT_MASK(MCDR2_ADDRESS)#define BIT_MASK(_bf)(((1U