Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let mut v = vec![1, 2, 3];
- // Modify vec in-place!
- square_each(&mut v);
- println!("{}", v[1]);
- }
- fn square_each(v: &mut Vec<i32>) {
- for e in v.iter_mut() {
- *e = (*e) * (*e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement