What is a Vector?
In this lesson, you will revise the basic concepts of vectors and how they provide more flexibility as compared to arrays.
Introduction
A vector is a collection that can store multiple values. It is allocated on the heap, which means its size is dynamic, and it doesn’t have to be defined at compile time, which provides more flexibility than arrays whose size has to be defined at compile time.
Declaring Vectors
We can define a vector in Rust as given below:
let vector: Vec<T>;
Here’s an example:
...Access this course and 1400+ top-rated courses and projects.