+ 1
How to get length of int array in c++?
Int a[10] = {1,2,3,4}; In this case i have to find length is 4 not size
4 Answers
+ 4
It's a C-style raw array. They don't come with a length, they're basically just a place in memory.
Usually, for convenience, you keep an extra size variable around to control that array.
Btw, the length of that array will always be 10, even if you only fill it up with 4 numbers - the remaining six will be set to zero.
+ 3
Idk a lot about c++, but isn't it sizeof(a[0])?
+ 1
By using string.h header file and strlen function