K
K
Karkes2021-12-05 15:12:09
C++ / C#
Karkes, 2021-12-05 15:12:09

How to declare a two-dimensional array?

Can an array be declared in this way ? byte[][] iter_num = new byte[16][32];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ayazer, 2021-12-05
@Karkes

if you need a square array then

byte[,] iter_num = new byte[16, 32];
iter_num[1,2] = 1;

if you need an array of arrays then already
byte[][] iter_num = new byte[16][];

for (var i=0; i<iter_num.GetLength(0); i++)
{
     iter_num[i] = new byte[32];
}
iter_num[1][2] = 1;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question