65、undef终止宏的作用域

#include<stdio.h>
#define A 2
#define B(a,b) a+b
//void f(void)
//{
// printf("%d,%d\n",A,B(4,1));
//}

void f(void);
#undef A
#undef B
int main()
{
f();
// printf("%d,%d\n",A,B(4,1)); error 因为此处不属于A,B的作用域
}

void f(void)
{
printf("%d,%d\n",A,B(4,1)); // error 因为此处不属于A,B的作用域
}

posted @ 2022-02-01 21:45  城北徐公135  阅读(113)  评论(0)    收藏  举报