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

Function recursive_func

Source Code/11-05.rs:12–16  ·  view source on GitHub ↗
(n: usize)

Source from the content-addressed store, hash-verified

10 const N_ARRAY: usize = 1_000_000;
11 fn create_array() -> Box<[u8; SIZE]> { Box::new([0u8; SIZE]) }
12 fn recursive_func(n: usize) {
13 let a = create_array();
14 println!("{} {}", N_ARRAY - n + 1, a[0]);
15 if n > 1 { recursive_func(n - 1) }
16 }
17 recursive_func(N_ARRAY);
18}

Callers 1

mainFunction · 0.70

Calls 1

create_arrayFunction · 0.70

Tested by

no test coverage detected