Beginner Rust
Q17 / 100

What is a lifetime in Rust?

Correct! Well done.

Incorrect.

The correct answer is B) An annotation describing how long a reference is valid, ensuring references do not outlive the data they point to

B

Correct Answer

An annotation describing how long a reference is valid, ensuring references do not outlive the data they point to

Explanation

Lifetime annotations ('a) on references let the compiler verify references don't outlive their data: fn longest<'a>(x: &'a str, y: &'a str) -> &'a str.

Progress
17/100