相关疑难解决方法(0)

我们可以有递归宏吗?

我想知道我们是否可以在C/C++中使用递归宏?如果是,请提供示例.

第二件事:为什么我无法执行以下代码?我在做什么错?是因为递归宏吗?

# define pr(n) ((n==1)? 1 : pr(n-1))
void main ()
{
    int a=5;
    cout<<"result: "<< pr(5) <<endl;
    getch();
}
Run Code Online (Sandbox Code Playgroud)

c c++ macros c-preprocessor

50
推荐指数
4
解决办法
4万
查看次数

标签 统计

c ×1

c++ ×1

c-preprocessor ×1

macros ×1