isPowerof(2)
在main()
导致预期);错误 ...这有什么问题?
#include<stdio.h>
#define isPowerof2(n) (!(n & (n-1))
int main(){
int n,p;
clrscr();
printf("\nEnter the number to be Checked:");
scanf("%d",&n);
isPowerof2(n);
printf("%d",p);
getch();
}
最佳答案
您还缺少一个括号:
#define isPowerof2(n) (!(n & (n-1)))
^
旁注:如果您不必使用宏,请改用函数。
关于c - 下面的宏使用有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19230179/