Can you help me to start with them I cant find any information about them
the exactly thing i need its Array of pointers where the pointers are pointing a menu like this idea below.
Pls just help me with the syntax ...
Can you help me to start with them I cant find any information about them
the exactly thing i need its Array of pointers where the pointers are pointing a menu like this idea below.
Pls just help me with the syntax ...
Your picture illustrates an array with 4 stars, not 3.
Break them down into smaller sets of pointers which will be easier to comprehend. The code below assumes the last item in each array is a NULL pointer so that the program will know where the end of the array is at. That avoids the problem of having to pass the array sizes along with the pointers.
void foo(char ****menuptr)
{
int i, j;
char ***menus = *menuptr;
for(i = 0; menus[i] != NULL; i++)
{
char** list = menus[i];
for(j = 0; list[j] != NULL; j++)
{
printf("%s\n", list[j]);
}
}
}
Work backwards :
Data m1p1;
Data m1p2;
Data m1p3;
Data m2p1;
Data m2p2;
Data* pointerToM1P1 = &m1p1;
Data* pointerToM1P2 = &m1p2;
Data* pointerToM1P3 = &m1p3;
Data* pointerToM2P1 = &m2p1;
Data* pointerToM2P2 = &m2p2;
Data** pointer_to_a_pointer_that_points_at_m1p1 = &pointerToM1P1;
Data** pointer_to_a_pointer_that_points_at_m1p2 = &pointerToM1P2;
Data** pointer_to_a_pointer_that_points_at_m1p3 = &pointerToM1P3;
Data** pointer_to_a_pointer_that_points_at_m2p1 = &pointerToM2P1;
Data** pointer_to_a_pointer_that_points_at_m2p2 = &pointerToM2P2;
Data*** pointer_to_a_pointer_that_points_at_a_pointer_that_points_at_m1p1 = &pointer_to_a_pointer_that_points_at_m1p1
//...and so on
But may I suggest you don't do this. If you tells us your actual problem, then we would probably be able to help.
Your picture illustrates an array with 4 stars, not 3.
Break them down into smaller sets of pointers which will be easier to comprehend. The code below assumes the last item in each array is a NULL pointer so that the program will know where the end of the array is at. That avoids the problem of having to pass the array sizes along with the pointers.
void foo(char ****menuptr) { int i, j; char ***menus = *menuptr; for(i = 0; menus[i] != NULL; i++) { char** list = menus[i]; for(j = 0; list[j] != NULL; j++) { printf("%s\n", list[j]); } } }
Ahhh sorry but I am really new in the pointers, so can you show me this code including the main function? Thank you!
AD, I suppose that is tripple pointer only...
The last one indicates the notation of the cells, like menu-1 pointer-1, menu-1 pointer-2 and so on.
Westony,
why dont you try to frame the main function by yourself.
Just simplify your task...
Send the root address(indicated by "All" in your diagram) as argument to function (from main function) and try to dereference all other linked memory locations (upto the simpler variables).
This will give you the idea how the pointers are functioning...try it out...
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.