+ 2
Why is C++ more picky than other language on making an array from a variable?
Java Int x = 5; Int[] y = new int[x]; â all good C++ Int x= 5; Int y[x]; Nope Even if x is a constant going through a method C++ is picky about it Const int x = 5 Method(x); } Method ( const int x){ Int y[x]; } Again it hates that
4 Answers
+ 3
Author seems to compare dynamical array in java with constant array in cpp? But there are many ways to make dynamical array in c or cpp: malloc & realloc in c, instruction new in cpp or even STL vector. So, what's the problem?)
+ 2
good
+ 1
Ace thanks, it makes alot of sense now