Solution: add a new solution for ownership-4

This commit is contained in:
Chloroplast
2022-08-21 17:02:48 +08:00
committed by GitHub
parent d334367182
commit 69643c9db0

View File

@ -96,6 +96,17 @@ fn print_str(s: String) {
}
```
```rust
fn main() {
let s = String::from("hello, world");
print_str(&s);
println!("{}", s);
}
fn print_str(s: &String) {
println!("{}",s)
}
```
5.
```rust