i321 [Rust] Ownership(소유권) 기초 예제 : i32 (32일차) [예제 코드_1] fn main() { let age: i32 = 25; do_something(age); } fn do_something(age: i32) { println!("Hello, {}", age); } [실행 결과] Hello, 25! [예제 코드_2] fn main() { let age: i32 = 25; do_something(age); println!("{}", age); } fn do_something(age: i32) { println!("Hello, {}", age); } [실행 결과] Hello, 25! 25 [예제 코드_3] fn main() { let age: i32 = 25; do_something(&age); println!("{}", age); } fn do_someth.. 2023. 1. 14. 이전 1 다음