c - What is wrong with the following macro usage? -


ispowerof(2) in main() causes expected ); error ...what wrong this?

#include<stdio.h>  #define ispowerof2(n)  (!(n & (n-1))  int main(){     int n,p;     clrscr();     printf("\nenter number checked:");     scanf("%d",&n);     ispowerof2(n);     printf("%d",p);  getch(); } 

you're missing 1 more bracket:

#define ispowerof2(n)  (!(n & (n-1)))                                     ^ 

side note: if don't have use macro, use function instead.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -