Beginner
Rust
Q10 / 100
What is the difference between &str and String?
Correct! Well done.
Incorrect.
The correct answer is B) &str is a borrowed reference to string data (string slice); String is an owned, heap-allocated, growable string
B
Correct Answer
&str is a borrowed reference to string data (string slice); String is an owned, heap-allocated, growable string
Explanation
&str is a view into string data (can point to a String or string literal). String owns its data and can grow. Use &str for function parameters accepting both.
Progress
10/100