because c-style arrays are not classes. They are primitive types and do not have members. Avoid them.
There is way to know size of array, but it is dangerous because arrays are easily decays into pointers. There is no way to know size of dynamic array.
best way is something like:
1 2 3 4 5 6
int main()
{
constint arr_size = 4; //Use constant instead of magic number
int mm[arr_size] {1, 2, 3, 4, };
std::cout << arr_size << std::endl;
}
Thanks. I was just wondering how I can get the size of an array that has been dynamically manipulated and changed. In Wolfram Mathematica it's just Length[m].
One more thing: how can I put a control so that if I am inputting integers it goes on to accept and so some stuff, but when I input a letter or word loop breaks? Is there a way to do it with "while" loop?