3

How do I return both multidimensional and unidimensional arrays, from C++ functions? Please explain completely!

   return MArray[][];
   return Array[];
Galik
  • 47,303
  • 4
  • 80
  • 117
  • 1
    It depends on whether the function itself gets these arrays or it should create arrays itself. – Vlad from Moscow Nov 16 '16 at 13:20
  • 4
    This: http://stackoverflow.com/questions/3473438/return-array-in-a-function And in more detail this: http://stackoverflow.com/questions/4264304/how-to-return-an-array-from-a-function – Makaronodentro Nov 16 '16 at 13:25
  • The linked answers don’t make this clear so I’ll restate it here: **you cannot return arrays in C++**. It’s simply impossible. What you can do is *wrap* an array and return the wrapper, or to use a different, array-like structure instead. But you can’t return an array. – Konrad Rudolph Nov 16 '16 at 13:43

0 Answers0