MCPcopy Create free account
hub / github.com/Apress/beginning-rust-2e / double

Function double

Source Code/09-32.rs:4–10  ·  view source on GitHub ↗
(a: &mut [i32; 10])

Source from the content-addressed store, hash-verified

2[10, -8, 18, 0, -14, -2, 6, 10, 6, 2]*/
3fn main() {
4 fn double(a: &mut [i32; 10]) {
5 use std::ops::IndexMut;
6 use std::ops::MulAssign;
7 for n in 0..10 {
8 (*(*a).index_mut(n)).mul_assign(2);
9 }
10 }
11 let mut arr = [5, -4, 9, 0, -7, -1, 3, 5, 3, 1];
12 double(&mut arr);
13 print!("{:?}", arr);

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected