I want to get the length of VA_ARGS
I used the answer of this question https://stackoverflow.com/a/2124433/7388699 but if doesn't work!
#define PIN_ARRAY_LENGTH(...) ((size_t)(sizeof((int[]){__VA_ARGS__})/sizeof(int)))
size_t c = PIN_ARRAY_LENGTH(1, 5, 7, 9);
I also tried
size_t x = sizeof((int[]){ 1, 6, 8 }) / sizeof(int);
It does not compile, I get the error: cast to incomplete array type "int []" is not allowed
#define CREATE_PIN_ARRAY(...) const unsigned int something[] { __VA_ARGS__ }? Not sure what you're gaining by hiding that behind a macro though. Edit: oh, there's the array size in there too. Hold on.