Dereferencing is a technique in Rust that enables programmers to access or modify the data located at a memory address designated by a pointer. Lets take an example
let x = 10;
let y = &x;
In the above example, x holds the value 10, and y holds the memory address of x.
println!("y is {}", y);
For example, if you print the y, Rust will automatically dereference it and print the x value, not the x’s memory address. But under the hood, y holds the memory address of x. Printing the value of x through y is called dereferencing, and Rust automatically does it.
println!("y is {}", *y);
You can also manually dereference the value of x through y, like the above code.