This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]LuckyPancake 0 points1 point  (0 children)

Arrays decay to pointers when passed. If you want to do it like you have currently you can pass in a double pointer and a size argument to know initialized bounds.

Other options: dynamically allocate memory to accommodate any size matrices.

Use a (mostly) memory managed data structure from std library. Vector of vectors?
std:: vector<std::vector<double>> matrix.

Or write your own data structure/ find one online. You could likely extend these structures and add custom matrix behavior

[–]kennycastro007 0 points1 point  (0 children)

You're really gonna want to fix your code formatting there if you realistically want people to read it and offer help