I would like to test if myCurrentPtr points inside my array a.
_B represents the number of values in a.
So, a + _B shall point the latest value of the array.
#define _B ((uint8_t)5)
volatile uint8_t a[5] = {0, 1, 2, 3, 4}; //`a` is a pointer to the first array element
if (myCurrentPtr > (a + _B)) {
printf("Out of bounds!");
}
Doesn't compile. Do you have any idea?
Whereas,
...
if (myCurrentPtr > (a + 5)) {
printf("Out of bounds!");
}
compiles just fine.
Aren't the two exactly the same after preprocessing?