Hi, if I have an array of pointers like char **lines, how can i determine its length? Thanks
I'll do. thanks
pistacchio
2009-05-05 21:46:29
+3
A:
You can't reliably.
Sometimes, there is a null pointer marking the end - it is one convention sometimes used. More often, you need to be told the length.
But there is no fool-proof way of determining the length. You have to know (or be told) the length, somehow.
Jonathan Leffler
2009-05-05 21:44:31
A:
It depends on the data. If there is no associated count, it could be a NULL terminated list.
char** lines = mysteryfunction();
for ( ;*lines;lines++ ) {
printf( "%s\n", *list );
}
Sanjaya R
2009-05-05 21:53:31