Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 2
    This is a good way to do it. You can also do vector<int> with size sizeX*sizeY for some nice extra safety. Commented Jun 1, 2009 at 21:34
  • 8
    The best thing is to wrap this code in a class - you can perform a clean-up in destructor and you can implements methods get(x, y) and set(x,y, val) instead of forcing user to do multiplication by himself. Implementing operator[] is more tricky, but I believe it's possible. Commented Jun 2, 2009 at 14:48