I want to use a basic macro in C to access a certain Bit b in a char-Array (*char) Arr:
#define TstBit (Arr,b) ( Arr[b/8] & (1 << (b%8)) )
however upon usage like such:
int foo(const char *charArray) {
int readindex = 0;
[...]
if(TstBit(charArray,readIndex++)) {
I get an error on the line with the #define-Statement:
main.c | line 7 | error: 'Arr' undeclared (first use in this function)
I'm suspecting I'm either passing the arguments poorly when calling the Function or that the #define needs some more parentheses.