strlen works if you end your array with a null character. You cannot find the number of elements in a char array unless you track it. those. save it in some variable, for example n. Every time you add increment of member n and every time you remove decrement n
source share