#include <iostream>
#include <vector>
#include <string.h>
#include <queue>
#include<stdio.h>
using namespace std;
#define to_str(name) (#name)
#define TIMx_ARR(n) TIM##n##_ARR
int main(void)
{
freopen("G:\\data.txt", "r", stdin);
int TIM1_ARR = 0;
int TIM2_ARR = 0;
TIMx_ARR(1) = 1;
TIMx_ARR(2) = 2;
cout << TIM1_ARR << endl;
cout << TIM2_ARR << endl;
cout << TIMx_ARR(2) << endl;
for(int i = 1; i <= 2; i++)
{
// TIMx_ARR(to_str(i)) = i*4; error , to_str(i) can not replace before TIMx_ARR;
}
printf("%s", to_str(457779));
return 0;
}
C语言字符串与变量名的转换
最新推荐文章于 2023-01-12 18:30:07 发布