코딩Coding/Rust연습
Rust연습)벡터안에 0 을 10개 넣기
내인생PLUS
2023. 6. 8. 17:39
728x90
fn main() {
let v: Vec<i32> = vec![];
let v = vec![1, 2, 3, 4, 5];
let v = vec![0; 10]; // ten zeroes
println!("{v:?}")
}
https://doc.rust-lang.org/stable/std/vec/index.html
std::vec - Rust
A contiguous growable array type with heap-allocated contents, written Vec . Vectors have O(1) indexing, amortized O(1) push (to the end) and O(1) pop (from the end). Vectors ensure they never allocate more than isize::MAX bytes. You can explicitly create
doc.rust-lang.org
반응형