How to create an empty vector of strings in Rust

1 Answer

0 votes
fn main() {
    // Create an empty vector of strings
    let vec: Vec<String> = Vec::new();

    // Get the size of the vector
    let size = vec.len();

    // Print the size
    println!("The size of the vector is: {}", size);
}


    
/*
run:

The size of the vector is: 0
   
*/

 



answered Jul 22 by avibootz
...