Skip to content

Instantly share code, notes, and snippets.

@ashiato45
Created March 17, 2017 11:23
Show Gist options
  • Save ashiato45/c56d18c00d687dba53862bd9412ac8c0 to your computer and use it in GitHub Desktop.
Save ashiato45/c56d18c00d687dba53862bd9412ac8c0 to your computer and use it in GitHub Desktop.
fn f<'a>(a: &'a mut i32, b: &'a i32){
*a += *b;
}
fn main() {
let mut a: i32 = 3;
println!("Hello, world! The number is {}", a);
{
let b: i32 = 2;
f(&mut a, &b);
println!("The number is {}", a);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment