Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn add_to_vec(v: &mut Vec<i32>) {
- v.push(5);
- }
- fn display_vec(v: &Vec<i32>) {
- println!("{:?}", v);
- }
- fn main() {
- let mut v = vec![1,2,3,4];
- let r = &mut v;
- add_to_vec(r);
- println!("{:?}",r);
- display_vec(&v);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement