Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. fn main() {
  2. // Fall For type 'String', mutable
  3. let mut s1 = String::from("hello");
  4. let t1 = &s1;
  5. println!("t1: the value of variable s1 is {}", t1);
  6. println!("t1: the stack address of variable s1 is {:p}", &t1);
  7. let s2 = &mut s1;
  8. //println!("s1: the value of variable s1 is {}", s1); // ERROR
  9. // println!("s1: the stack address of variable s1 is {:p}", &s1); // ERROR
  10. println!("s2: the value of variable s2 is {}", s2);
  11. println!("s2: the stack address of variable s2 is {:p}", &s2);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement