Skip to content

Instantly share code, notes, and snippets.

@H2CO3
Last active July 17, 2016 19:00
Show Gist options
  • Save H2CO3/85f819bb0a734efa6a3d120438cb8d59 to your computer and use it in GitHub Desktop.
Save H2CO3/85f819bb0a734efa6a3d120438cb8d59 to your computer and use it in GitHub Desktop.
fn take_mut_ref(ptr: &mut i32) {
*ptr += 1;
}
fn main() {
let mut x = 42;
{
let ptr = &mut x;
take_mut_ref(ptr);
println!("{:p}", ptr);
}
println!("{}", x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment