Created
November 11, 2019 19:48
-
-
Save rust-play/060f418bf44a75ede6cbd7eee02da9c7 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main(){ | |
let mut x = 0; | |
let r = &mut x; | |
let p = r as *mut _; | |
*r = 4; | |
unsafe{ | |
*p += 1; | |
} | |
*r = 3; | |
println!("{}", x); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment