I have a dynamic array of c-strings
char **my_strings = (char**)malloc(50 * sizeof(char*));
and I want to find it's actual length (how many strings it actually contains). How can I do this?
A char * is not a "string": it is a pointer. Strings are arrays where one of its elements is '\0'.
Pointers and arrays are different!
Check section 6 of the c-faq.
while (!strings[count] == NULL) count++;argv[argc]isNULLC11 §5.1.2.2.1 2, C also set the last element toNULL. Is that redundant? Did I ask that before? Courtesy of department of redundancy department ;-) ;-)