I have used a similar approach for the fixed size arrays ie sizeof(a)/sizeof(int) but i was not sure how would it manifest for variable length string array . Can anyone throw some light on it
One thing that wasn't mentioned is that the moment you pass the array to a function, sizeof cannot be used to determine the size of the array any longer. It is important to keep track of the size after its initial creation so that you can pass it along with the array to any function that operates on the array.
On the other hand if you use sequence containers such as std::string, std::vector, std::deque, etc the size information is built into the object which eliminates the need to keep track of size info separately from the array. The drawback to that of course is that you can't use that fun aggregate initialization style with c++.