...

/

Multidimensional Arrays and Vectors

Multidimensional Arrays and Vectors

Learn about multidimensional arrays and jagged arrays.

In this lesson, you will move towards the advanced concepts of arrays, i.e., multidimensional arrays. A two-dimensional array is the simplest form of a multidimensional array. You can see a two-dimensional array as an array of the one-dimensional array for easier understanding.

Multidimensional array declaration and initialization

Two dimensional array declaration in Rust:

let arr_2d: [[i32;2];2];

In the above code we’re declaring an array arr which contains two i32 arrays having sizes of 2.

The values can be provided at the time of the declaration of an array like this:

let arr_2d = [[1,2],[2,3]];

Multidimensional vector declaration and initialization

Rust also ...

Access this course and 1400+ top-rated courses and projects.