Answers for "swap elements in array rust"

0

rust swap vector elements

fn main() {
    let mut numbers = vec![1, 2, 3];
    println!("before = {:?}", numbers);
    numbers.swap(0, 2);
    println!("after = {:?}", numbers);
}
Posted by: Guest on June-16-2020

Code answers related to "swap elements in array rust"

Browse Popular Code Answers by Language