i have this in a header file:
and this source file:Code:... #define IND_BIT (N) ((N) / NUM_BITS) /* Find array index for Nth bit */ #define POS_BIT (N) ((N) % NUM_BITS) /* Find position of Nth bit */ #define SET_BIT (barr, N) ((barr)[IND_BITS(N)] |= (bitarr)1 << POS_BITS(N)) /* Set Nth bit */ ...
What's the problem?Code:#include <stdio.h> #include "ba.h" #define M 10 int main(void) { bitarr a[SIZ_BITS(M)] = {0}; int i; SET_BIT (a, 5); for (i = 0; i < M; i++) if ( TST_BIT(a, i) ) printf("%dth bit set\n",i); return 0; }
I get these errors:
Code:bitarr.c:8: `N' undeclared (first use in this function) bitarr.c:8: (Each undeclared identifier is reported only once bitarr.c:8: for each function it appears in.) bitarr.c:12: `barr' undeclared (first use in this function) bitarr.c:15: called object is not a function bitarr.c:15: called object is not a function bitarr.c:16: syntax error before "printf"



LinkBack URL
About LinkBacks


