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.

12
  • 4
    I need to do this in a class, hence I can't use auto. What would be the proper type for the array?
    – Peter Smit
    Commented May 27, 2013 at 14:38
  • 5
    Can you use this then: using arr2d = double(*)[2]; arr2d array = new double[M][N]; Commented May 27, 2013 at 17:06
  • 5
    +1: this is what the OP asked for. The proper type for this is either double (*)[M][N] or double(*)[][N] with M, N being constant expressions.
    – Fozi
    Commented Sep 30, 2013 at 18:09
  • 74
    Problem with this solution is that the dimensions cannot be a run-time value, but should be known at compile-time.
    – legends2k
    Commented Oct 26, 2013 at 14:18
  • 5
    @vsoftco Yes, indeed, however the question was specifically about having both dimensions unknown at compile-time.
    – legends2k
    Commented Dec 4, 2015 at 5:45