I\'d like to initialize a vector of zeros with a specific size that is determined at runtime.
In C, it would be like:
Here is another way, much shorter. It works with Rust 1.0:
fn zeros(size: u32) -> Vec { vec![0; size as usize] } fn main() { let vec = zeros(10); for i in vec.iter() { println!("{}", i) } }