Try to find out how to get the total number of items in char* numberlist[] in C and C++, the following is the code:
const char* list_of_filename[] = {"One","Two","Three","Four","Five"};
The standard idiom for finding the number of elements in an array is
int num_items = sizeof(list_of_filename) / sizeof(list_of_filename[0]);
How about:
sizeof(list_of_filename) / sizeof(char*)
Or more generally:
sizeof(list_of_filename) / sizeof(list_of_filename[0])
[0] version, so I wouldn't feel right about editing in the other version. Feel free to edit it into your answer though - I gave you an upvote : - Timothy Jones 2012-04-05 02:02
sizeof(list_of_filename) / sizeof(*list_of_filename)Adam Liss 2012-04-05 01:56