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
Post a Comment