I'm learning C++.
I only need a matrix and SPECIALLY how many rows and columns are in the matrix. I've though that I can use the following structure:
struct map {
int rows;
int columns;
int matrix[rows][columns];
}
But, it doesn't compile. There is an error on line: int matrix[rows][columns];
I have also tried:
struct map {
int rows;
int columns;
int matrix[map.rows][this.columns];
}
But, it doesn't compile.
The map.matrix
will have map.rows
and map.columns
. I have declared this way because I don't know if I can declared without specifying its dimensions.
If it is correct to do: int matrix[][];
.
What do I have to do to make the map.matrix
have map.rows
rows and map.columns
columns?