playing with the mutable references
This commit is contained in:
parent
62b4865c9c
commit
0a2003dfc8
|
@ -9,8 +9,13 @@ fn main() {
|
|||
println!("t 2nd: {}", t.1);
|
||||
|
||||
let mut x: i32 = 10;
|
||||
let mut z: i32 = 5;
|
||||
println!("x: {x}");
|
||||
let ref_x: &mut i32 = &mut x;
|
||||
println!("z: {z}");
|
||||
let mut ref_x: &mut i32 = &mut x;
|
||||
*ref_x = 20;
|
||||
println!("x: {x}");
|
||||
ref_x = &mut z;
|
||||
*ref_x = 20;
|
||||
println!("z: {z}");
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue