#include <stdio.h> #define STR(s) #s #define CONS(a,b) (int)(a##e##b) int main() { printf(STR(vck)); printf("\n"); //vck //2000 printf("%d\n",CONS(2,3); return 0 }
宏定義中,#把宏參數變爲一個字符串,用##把兩個宏參數貼合在一起。
#include <stdio.h> #define STR(s) #s #define CONS(a,b) (int)(a##e##b) int main() { printf(STR(vck)); printf("\n"); //vck //2000 printf("%d\n",CONS(2,3); return 0 }
宏定義中,#把宏參數變爲一個字符串,用##把兩個宏參數貼合在一起。