Answers for "rust array trait"

1

rust lang make array

let mut array: [i32; 3] = [0; 3];

array[1] = 1;
array[2] = 2;

assert_eq!([1, 2], &array[1..]);

// This loop prints: 0 1 2
for x in &array {
    print!("{} ", x);
}
Posted by: Guest on September-17-2020

Browse Popular Code Answers by Language