diff options
author | garhve <git@garhve.com> | 2022-12-26 16:52:29 +0800 |
---|---|---|
committer | garhve <git@garhve.com> | 2022-12-26 16:52:29 +0800 |
commit | 3172b239863e1151d85197fdb4ea3e42d421256e (patch) | |
tree | 81e4eb4eb06725f17188bf85d9cd7305eceedab3 /rust/theBook/chapter-4-understanding-ownership/emp1.rs | |
parent | 1dece36fd7e315aee98f1c06d7064fbd6ef877e8 (diff) |
finish chapter 5
Diffstat (limited to 'rust/theBook/chapter-4-understanding-ownership/emp1.rs')
-rw-r--r-- | rust/theBook/chapter-4-understanding-ownership/emp1.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/rust/theBook/chapter-4-understanding-ownership/emp1.rs b/rust/theBook/chapter-4-understanding-ownership/emp1.rs new file mode 100644 index 0000000..a0f4bbd --- /dev/null +++ b/rust/theBook/chapter-4-understanding-ownership/emp1.rs @@ -0,0 +1,9 @@ +fn main() { + let mut s = String::from("hello"); + + let r1 = &s; + let r2 = &s; + println!("{},{}",r1,r2); + let r3 = &mut s; + println!("{r3}"); +} |