I have read some posts about dynamic growing arrays in C, but I can’t see how to create a 2D growing array (like in MATLAB).
I have a function to construct an array for some image processing, but I don’t know what will be the size of this array (cols and rows). How can I create this?
I read something about malloc and realloc. These functions are portable or useful for this problem.
EDIT: SOLVED, using the Armadillo library, a C++ linear algebra library.
Simplest is with pointers
And then you can access it as if it’s a 2D array like.
So if you want
matrix[row][col], you’d doAlso, if you want the comfort of Matlab like matrixes in C++, look into Armadillo