Skip to content

Instantly share code, notes, and snippets.

@piisalie
Created August 23, 2014 02:14
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 piisalie/80c67b76c0f08768e517 to your computer and use it in GitHub Desktop.
Save piisalie/80c67b76c0f08768e517 to your computer and use it in GitHub Desktop.
fn increment_mut(p: &mut Vec<int>) {
for num in p.mut_iter() {
*num = *num + 1
}
}
fn main() {
let mut p = vec![1i, 2, 3];
increment_mut(&mut p);
for &x in p.iter() {
print!("{:d} ", x);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment