Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- // Fall For type 'String', mutable
- let mut s1 = String::from("hello");
- let t1 = &s1;
- println!("t1: the value of variable s1 is {}", t1);
- println!("t1: the stack address of variable s1 is {:p}", &t1);
- let s2 = &mut s1;
- //println!("s1: the value of variable s1 is {}", s1); // ERROR
- // println!("s1: the stack address of variable s1 is {:p}", &s1); // ERROR
- println!("s2: the value of variable s2 is {}", s2);
- println!("s2: the stack address of variable s2 is {:p}", &s2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement