I know this question has been asked a thousand times, but I can't find a solution for my case.
I what to get the length of a string array in a given function. This is for an arduino board.
#define LEN(x) sizeof(x)/sizeof(x[0])
const char* mainMenu[] = {"FirstWord", "SecondWord", " "};
void myFunction(const char** m) {
int a = LEN(m);
/* Do something */
};
void setup(){
myFunction(mainMenu);
};
The LEN(m)
works fine in the setup()
function. But in myFunction()
it either gives me 1 (i guess the length of the pointer) or 9 (length of the 0th element of the array)