Answers for "Create and populate a 2d vector"

0

Create and populate a 2d vector

// Create and populate a 2d vector
fn main() {
    // Two dimensional vector
    let mut v5:Vec<Vec<usize>> = Vec::new();
    let last = 5;
    for i in 0..last {
        v5.push(vec![]);
        for j in 0..last {
            v5[i].push(j);
        }
    }
    println!("{:?}",v5);
}
Posted by: Guest on April-06-2022

Code answers related to "Create and populate a 2d vector"

Browse Popular Code Answers by Language