Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It is because the variable i is being used as a reference, meaning it will hold a memory address instead of the actual value. Therefore, it needs to be declared as a reference to a usize type, which is denoted by &usize. This is a common practice in Rust to ensure safe memory management and avoid issues such as null pointer dereferencing.