Almost. It is legal, but it should not compile because nothing has been initialized.Tell me to go back to the C board if you want but is this legal in C++?
Almost. It is legal, but it should not compile because nothing has been initialized.Tell me to go back to the C board if you want but is this legal in C++?
Last edited by Enahs; 09-20-2005 at 09:44 PM.
This Works Great....thank You For All Of Your Help. If Ever In The Nw Pa Area Maybe I Can Take You For A Plane Ride....as I Am A Pilot Too.
I don't think so. I think x should be constant. Someone please correct me if I'm wrong, but I believe the standard way to dynamically allocate an array is:Originally Posted by sand_man
Edit:Code:int x = 5; int* arr = new int[x];
And VS 2003 won't compile it:
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2133: 'array' : unknown size
Last edited by JaWiB; 09-20-2005 at 11:17 PM.
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
I move we create a seperate topic when referring to what VS doesnt like and put it in its own forum.. because VS's a loner.Originally Posted by JaWiB
Warning: Have doubt in anything I post.
GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101