How to properly work with dynamically-allocated multi-dimensional arrays in C++ [duplicate]
This question already has an answer here: How do I declare a 2d array in C++ using new? 23 answers How do I define a dynamic multi-dimensional array in C++? For example, two-dimensional array? I tried using a pointer to pointer, but somehow it is failing. The first thing one should realize that there is no multi-dimensional array support in C++, either as a language feature or standard library. So anything we can do within that is some emulation of it. How can we emulate, say, 2-dimensional array of integers? Here are different options, from the least suitable to the most suitable. Improper