...

/

Borrowing and Dereferencing Operators

Borrowing and Dereferencing Operators

This lesson discusses the borrowing and dereferencing operator in Rust.

Borrowing Operator #

Borrowing means to reference the original data binding or to share the data.

References are just like pointers in C.

Two variables are involved in a borrowing relationship when the referenced variable holds a value that the referencing variable borrows. The referencing variable simply points to the memory location of the referenced variable.

svg viewer

The following illustration shows that operand 1 borrows the value of operand 2 ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy