扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:唯c世界 2007年10月28日
关键字: Linux
#include "stdio.h" #define exchange(a,b) { /*宏定义中允许包含两道衣裳命令的情形,此时必须在最右边加上"\"*/ int t;\ t=a;\ a=b;\ b=t;\ } void main(void) { int x=10; int y=20; printf("x=%d; y=%d\n",x,y); exchange(x,y); printf("x=%d; y=%d\n",x,y); } |
#define LAG > #define SMA < #define EQ == #include "stdio.h" void main() { int i=10; int j=20; if(i LAG j) printf("\40: %d larger than %d \n",i,j); else if(i EQ j) printf("\40: %d equal to %d \n",i,j); else if(i SMA j) printf("\40:%d smaller than %d \n",i,j); else printf("\40: No such value.\n"); } |
#include "stdio.h" #define MAX #define MAXIMUM(x,y) (x>y)?x:y #define MINIMUM(x,y) (x>y)?y:x void main() { int a=10,b=20; #ifdef MAX printf("\40: The larger one is %d\n",MAXIMUM(a,b)); #else printf("\40: The lower one is %d\n",MINIMUM(a,b)); #endif #ifndef MIN printf("\40: The lower one is %d\n",MINIMUM(a,b)); #else printf("\40: The larger one is %d\n",MAXIMUM(a,b)); #endif #undef MAX #ifdef MAX printf("\40: The larger one is %d\n",MAXIMUM(a,b)); #else printf("\40: The lower one is %d\n",MINIMUM(a,b)); #endif #define MIN #ifndef MIN printf("\40: The lower one is %d\n",MINIMUM(a,b)); #else printf("\40: The larger one is %d\n",MAXIMUM(a,b)); #endif } |
#define LAG > #define SMA < #define EQ == #include "test.h" /*一个新文件50.c,包含test.h*/ #include "stdio.h" void main() { int i=10; int j=20; if(i LAG j) printf("\40: %d larger than %d \n",i,j); else if(i EQ j) printf("\40: %d equal to %d \n",i,j); else if(i SMA j) printf("\40:%d smaller than %d \n",i,j); else printf("\40: No such value.\n"); } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。