1 #include <iostream> 2 3 using namespace std; 4 5 //宏,变量名转换为字符串 6 #define NAME(name) (#name) 7 8 int main() 9 { 10 int int_variate_name = 0; 11 cout << NAME(int_variate_name) << endl; 12 13 return 0; 14 }
#来源为网络。
1 #include <iostream> 2 3 using namespace std; 4 5 //宏,变量名转换为字符串 6 #define NAME(name) (#name) 7 8 int main() 9 { 10 int int_variate_name = 0; 11 cout << NAME(int_variate_name) << endl; 12 13 return 0; 14 }
#来源为网络。
转载于:https://www.cnblogs.com/peformer/p/8520875.html