I am confused with the * and & operator in Rust, it seems to do the same thing with the code I have written.
fn main() {
let mut testnum: u32 = 10;
println!("{}", testnum);
changeme(&mut testnum);
println!("{}", testnum);
}
fn changeme(num: &mut u32) -> () {
*num = 11;
println!("{}", &num);
println!("{}", *num);
println!("{}", num);
}
output:
10
11
11
11
11
I am confused why '&num', '\*num', and 'num' prints the same value. Can someone explain why this happens?