Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created November 11, 2019 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/060f418bf44a75ede6cbd7eee02da9c7 to your computer and use it in GitHub Desktop.
Save rust-play/060f418bf44a75ede6cbd7eee02da9c7 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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