小编Yul*_*ian的帖子

在C语言中使用宏

我需要使用宏来连接字符串以生成函数名称.

#define CONCAT(a,b,c) a ## b

int i=1;
CONCAT(a,i)
Run Code Online (Sandbox Code Playgroud)

这个代码给出ai了我想要的结果a1.

由于我的源代码中有许多函数,我不想枚举它们.

我的目标:

for(int i=0;i<100;i++)
{
    Funi1();//here i should be from  0 to one hundred 
    Funi2();
    Funi3();
    Funi4();
    ..
}
Run Code Online (Sandbox Code Playgroud)

@Potatoswatter

我编写了一个脚本来扩展它,输出文件花费了一百行.@Eric Finn

c c++ macros

0
推荐指数
1
解决办法
195
查看次数

标签 统计

c ×1

c++ ×1

macros ×1