N
Noah Roberts
The said:I have a dynamically declared array of integers and i'd
like to check the number of elements. For some reason,
the expected sizeof(mtx)/sizeof(mtx[0]) doesn't
work. I've been googling and i got a head ache more
than understanding.
You can't do it.
Let me put my question this way. In Java, i'd go as
mtx.length to learn the size. How can it be done
_easily_ in C++? The shorter the better.
If you use std::vector<> instead of a dynamically allocated array you
will be able to get the element count from the size() member.