I have two char pointer arrays:
char* mainMenu[] = {"Start", "Mode"};
char* subMenu[] = {"Mode1", "Mode2", "Mode3"};
I put both arrays in an array containing pointer to pointer:
char **menus[] = {mainMenu, subMenu};
Now I'd like to get the size of the subMenu array by using menus.
With subMenu it works:
int num = sizeof(subMenu)/sizeof(subMenu[0]); // num = 3
But I'd like to do this with menus, i tried:
int num2 = sizeof(*(menus[1]))/sizeof(*(menus[1]))[0]; // num2 = 2
What do i have to do with menus to get 3 as a result?
printf("%zu\n", sizeof menus / sizeof menus[0]);outputs2, which is the same way you did it before.sizeofandmenus. (don't want to get the result by usingsubMenu)