I have found a lot of solutions using Google but no solution did work.
Could you please tell me how we can return a 3x3 matrix in c++ function.
My code is:
double *A = new double;
// some operations on A and then return
The error that I have in this case is:
error C2440: 'initializing' : cannot convert from 'double (*)' to 'double *'
Thank you in advance
Last edited on
Thank you so much Peter87.
In the case of
std::array<std::array<double, 2>, 2> A; which I prefer, how we can scan the elements? using iterator as the case in vector?
Iterators or by index like normal arrays.
Thank you ;)
Have a nice day.
std::array was added in C++11 so maybe you have to turn on C++11 features somehow. If you are using GCC you can do that by passing -std=c++11 (or -std=c++0x) to the compiler.
I am using Visual c++ 2008.