I need to check if an array is empty using macros. If the size of array is constant say 2, then I will be able to write a macro like
#define IS_EMPTY(arr) \
((arr[0] | arr[1]) == 0)
But if arr is defined like this
#define ARRAY_SIZE 100
int arr[ARRAY_SIZE];
Is there any way, a macro can determine that the array is empty? Or is inline functions the only option.
Your most viable options would be a loop:
or memcmp: