Answers for "rust vector swap"

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

Browse Popular Code Answers by Language