dead topic

dead topic
Last edited on
This shouldn't compile, actually. Line 19 doesn't work; you need to use dynamic variables if you want to do that.
It seems to be compiling fine in codeblocks.
You're right, in VS2012 it doesn't compile but in Code::Blocks it does. I'm not educated enough to say why but you need a constant expression to initialize an array, or like Ispil said, dynamic memory to allocate it at runtime:

int *pA = new int[amount]; // don't forget to delete[] it when you've finished with it

Also I'm not sure what purpose int w = 0; is serving as it is unused.
Last edited on
Yeah, now that I look at it, there are a few useless things in the code! Thanks Ispil and Codeez! I'm going to google more information on constant expressions and dynamic memory.
Topic archived. No new replies allowed.