From 6b3fb812c8a4caf5b47ecf6cf23a134586f67e1d Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 4 Oct 2024 08:15:51 -0600 Subject: [PATCH] A bit more clarity about all the stack types in 3.2 Fixes #4009 --- src/ch03-02-data-types.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ch03-02-data-types.md b/src/ch03-02-data-types.md index 2cfc156e89..84af90e3f6 100644 --- a/src/ch03-02-data-types.md +++ b/src/ch03-02-data-types.md @@ -271,14 +271,14 @@ brackets: {{#rustdoc_include ../listings/ch03-common-programming-concepts/no-listing-13-arrays/src/main.rs}} ``` -Arrays are useful when you want your data allocated on the stack rather than -the heap (we will discuss the stack and the heap more in [Chapter -4][stack-and-heap]) or when you want to ensure you always have a -fixed number of elements. An array isn’t as flexible as the vector type, -though. A *vector* is a similar collection type provided by the standard -library that *is* allowed to grow or shrink in size. If you’re unsure whether -to use an array or a vector, chances are you should use a vector. [Chapter -8][vectors] discusses vectors in more detail. +Arrays are useful when you want your data allocated on the stack, the same as +the other types we have seen so far, rather than the heap (we will discuss the +stack and the heap more in [Chapter 4][stack-and-heap]) or when +you want to ensure you always have a fixed number of elements. An array isn’t as +flexible as the vector type, though. A *vector* is a similar collection type +provided by the standard library that *is* allowed to grow or shrink in size. If +you’re unsure whether to use an array or a vector, chances are you should use a +vector. [Chapter 8][vectors] discusses vectors in more detail. However, arrays are more useful when you know the number of elements will not need to change. For example, if you were using the names of the month in a