Make the Rust array mutable
- mut
fn main() { let mut numbers: [i32; 3] = [10, 11, 12]; println!("{:?}", numbers); numbers[0] = 30; println!("{:?}", numbers); }
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
fn main() { let mut numbers: [i32; 3] = [10, 11, 12]; println!("{:?}", numbers); numbers[0] = 30; println!("{:?}", numbers); }