Rust Data StructuresLesson 23Free preview
Rust Arrays
This lesson is part of Rust · All levels
Summary
This lesson reviews an array in Rust that is a set of elements of the same type with a fixed length. Because it's stored in stacks, the array is very fast and efficient. The reader will learn to declare an array, access elements through an index, and understand the bound check.
Key points
- The array has uniform types and fixed sizes known since compilation
- The array type declaration is formatted '[Type; Number of Elements]'
- The array index starts with a number of 0.
- Out of bounds index access will trigger runtime panic for memory security
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.