Click here to Skip to main content
15,896,429 members

Response to: Expression must have a constant value

Revision 1
The expression must be constant at compile time. Your code uses a run-time constant. A compile time constant would look like this:
C++
const int x = 5;
Point *Room[x]; // OK here

To create an array at runtime, use the new operator:
C++
Point *Room = new Point[size];
// Use Room here
// ...
// Delete it when finished
delete [] Room;
Posted 13-Feb-13 0:47am by Jochen Arndt.
Tags: