扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:唯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领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者