but what does const int max size do? |
const int max size
it’s simply illegal C++ syntax.
const int MAX_SIZE
, as JLBorges wrote, defines a variable of type ‘int’ and qualifies it as constant, i.e. it can’t be modified once initialized.
May I be so bold to ask you if you are attending some course, trying to put together some code or... what else? Just to understand which type of help you are looking for. To be totally honest, it’s the first time I come across a post where someone claims they can’t understand their own code.
C++ doesn’t allow an array to be creted by a value which is not constant (unless you use “new” or “malloc()” or other workarounds). Unfortunately, some compiler, if not correctly ‘set’, doesn’t follow this rule and let the programmer write code which is not (entirely) legal.
You know what a compiler is, by the way, do you?
The rest of the JLBorges' code just propose this simple solution to that problem: create an array which is likely to be *way* bigger than the one you reckon you need, and later, if the user asks for even a higher number of “rows”, downsize their megalomaniac requests to the level you previously chose.