【发布时间】:2013-10-14 08:12:01
【问题描述】:
isPowerof(2) in 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();
}
【问题讨论】:
-
顺便提一下,
isPowerof2中的表达式将表明零是 2 的幂,这是不正确的。
标签: c syntax macros compiler-errors