diff --git a/src/ch08-01-vectors.md b/src/ch08-01-vectors.md index 6b1d04d135..ccb733a52a 100644 --- a/src/ch08-01-vectors.md +++ b/src/ch08-01-vectors.md @@ -171,8 +171,6 @@ to use a `for` loop to get immutable references to each element in a vector of -To read the number that `n_ref` refers to, we have to use the `*` dereference operator to get to the value in `n_ref` before we can add 1 to it, as covered in ["Dereferencing a Pointer Accesses Its Data"][deref]. - We can also iterate over mutable references to each element in a mutable vector in order to make changes to all the elements. The `for` loop in Listing 8-8 will add `50` to each element. @@ -185,7 +183,7 @@ will add `50` to each element. -To change the value that the mutable reference refers to, we again use the `*` dereference operator to get to the value in `n_ref` before we can use the `+=` operator. +To change the value that the mutable reference refers to, we use the `*` dereference operator to get to the value in `i` before we can use the `+=` operator. {{#quiz ../quizzes/ch08-01-vec-sec1.toml}}