I have 2 two dimensional arrays. At some point, I need to pick one of the two and loop over it. What kind of pointer do I need to point to a 2 dimensional array in order to loop over it ?
const char *a[] = {
"example1",
"example2",
NULL
};
const char *b[] = {
"example1",
"example2",
"example3",
"example4",
"example5",
NULL
};
const char *pointer = a;
int count = 0;
while(pointer != NULL)
{
puts(pointer[count]);
count++;
}
You just need one more
*:Your loop condition is wrong too – I think you want: