Home Forums C Programming Array Problem Re: Re: Array Problem


Unless theres a new C++ standard , you cannot declare arrays of an arbitrary length ( the length must be declared as a constant so the compiler knows how to set up the function’s stack frame at compile time ). So you can’t do this ( I’m suprised this compiled, what compiler are you using ?):

If you want a arbitrary length array you have to allocate it at run time , like:

make sure to check allocation of this statement and delete the memory when your done with it ( by the end of the function call )………