KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to create a class as such: class CLASS { public: //stuff private: int x, y; char array[x][y]; }; Of course, it doesn't work until I change int x, y; to const static int x = 10, y = 10; Which is impractical, because I am trying to read the values of x and y from a file. So is there any way to initialize an array with non-contant values, or declare an array and declare its size on different statements? And I know this would probably require the creation of an array class, but I'm not sure where to start on this, and I don't want to create a 2D dynamic list when the array itself is not dynamic, just the size is not known at compile-time.
Tags (comma-separated)
Save Edits
Cancel