fn sum(x: &[u8]) -> usize {
let mut tot = 0;
for i in 0..10 {
tot += x[i] as usize
}
return tot;
}
fn func(y: &[u8]) -> usize {
let tot = sum(&&&&y); /* Look here! */
return tot;
}
fn main() {
let w: [u8; 10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let tot = func(&w);
println!("{}", tot);
}
This program works identically irrespective of the number of &'s where indicated. Whats going on, and what is the correct syntax?