VEC1 [Rust] Ownership(소유권) 기초 예제 : Vec<String> (34일차) [예제 코드_1] fn main() { let names = vec![ String::from("John"), String::from("Jane"), ]; do_something(names); } fn do_something(names: Vec) { println!("{:?}", names); } [실행 결과] ["John", "Jane"] [예제 코드_2] fn main() { let names = vec![ String::from("John"), String::from("Jane"), ]; do_something(names); println!("{:?}", names); } fn do_something(names: Vec) { println!("{:?}", names); } [실행 결과] error[.. 2023. 1. 16. 이전 1 다음