Skip to content

Instantly share code, notes, and snippets.

@ashiato45
Created March 17, 2017 11:12
Show Gist options
  • Save ashiato45/8c69702ad2d51aaca7270c118686f1cb to your computer and use it in GitHub Desktop.
Save ashiato45/8c69702ad2d51aaca7270c118686f1cb to your computer and use it in GitHub Desktop.
fn f(a: &mut i32, b: &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