mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
Update ownership.md.
Borrowing the variables in the first problem
This commit is contained in:
@ -31,6 +31,15 @@ fn main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
fn main() {
|
||||||
|
let x = String::from("hello, world");
|
||||||
|
let y = &x;
|
||||||
|
println!("{},{}",x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
2.
|
2.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
Reference in New Issue
Block a user