//注意宏展开后就是一行字符串,其中的注释千万不能使用//,这样就会把后面的宏全部注释
//而是要必须使用/*comment*/来解决
//并且不能像函数那样使用,因为这只是一个字符串而已
#define func(x) \
if(x<10){ \
x=x+'0'; \
cout << hex << x << endl; \
return x; /*这样就直接return了在main中*/ \
/*return x; //error!!!*/ \
} else { \
x=(x-10)+'A';\
cout << hex << x << endl;\
return x; \
/*return x; //error!!!*/ \
}
#define f(x) x*x*x
c语言宏使用的注意事项
最新推荐文章于 2019-11-12 13:15:24 发布