Hi, I need to scan a matrix in Crystal, but I found nothing in the documentation where it could be implemented in an "easy" way, as well as declaring the vectors.
How can I create a matrix of defined sizes and fill value in it as in the following code in C:
int matrix[DIM][DIM];
int rom, collumn;
for(row = 0 ; row < DIM ; row++)
for(collumn = 0 ; collumn < DIM ; collumn++)
{
matrix[row][collumn] = 0;
}
DIM = 5
matrix = Array.new(DIM) { |i| Array.new(DIM) { |j| 0 } }
p matrix
Thanks, bro.
Most helpful comment