标签:
#define
1 #include<stdio.h> 2 #define paster(n) printf("token"#n"=%d\n",token##n) 3 4 int main(int argc,char *argv[]) 5 { 6 int token9=10; 7 paster(9); 8 return 0; 9 } 10 输出为:token 9 = 10
1 #include<stdio.h> 2 #defineM(a+b) 3 4 int main(intargc,char*argv[]) 5 { 6 ints,a,b; 7 printf("inputnumbera&b:"); 8 scanf("%d%d",&a,&b); 9 s=M*M; 10 printf("s=%d\n",s); 11 }
1 #include<stdio.h> 2 #define MAX(a,b)((a>b)?(a):(b)) 3 4 int main(intargc,char*argv[]) 5 { 6 intx,y,max; 7 printf("inputtwonumbers:"); 8 scanf("%d%d",&x,&y); 9 max=MAX(x,y); 10 printf("max=%d\n",max); 11 return0; 12 }
标签:
原文地址:http://www.cnblogs.com/wangqw/p/4230915.html