how get size of this array
how get the number of element of this array
|
char *m[2] = {"eee","sasas"}
|
Count them. I see two.
Part of handling arrays is keeping track of their size and how many elements are used in them.
If you want to do it in code, the C++ way is with templates:
1 2 3 4 5
|
template <typename T, size_t N>
inline size_t sizeof_array( const T (&a) [ N ] )
{
return N;
}
|
http://www.cplusplus.com/forum/general/33669/
The other method is used in C, but it can be easily misused (as indicated in the thread I linked to you).
Here is a good article to read that touches on many topics to handling array sizes and dealing with functions.
http://cplusplus.com/forum/articles/20881/
Good luck!
Topic archived. No new replies allowed.