Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

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);
}
 
PREVIOUS NEXT
Tagged: #Create #populate #vector
ADD COMMENT
Topic
Name
9+9 =