Create a dynamic list in Rust using Vec::new() or the vec! macro to store and manage collections of same-type values.
Use Vec::new() to create an empty vector or vec![] to create one with initial values. Vectors store elements of the same type on the heap and grow dynamically.
fn main() {
let empty: Vec<i32> = Vec::new();
let with_data: Vec<i32> = vec![1, 2, 3];
let mut v = with_data;
v.push(4);
}
A Vec is like a dynamic list that automatically grows as you add more items. You use it when you need to store a collection of data where the size isn't known ahead of time, similar to a shopping list that expands as you add groceries.