A

Admin • 828.03K Points
Coach

Q. What is the default behavior of Rust when accessing an index out of bounds in a vector?

  • (A) Returns None
  • (B) Panic at runtime
  • (C) Wraps around
  • (D) Returns -1
  • Correct Answer - Option(B)
  • Views: 10
  • Filed under category Rust
  • Hashtags:

Explanation by: Admin
Accessing an invalid index with `vec[i]` causes a panic.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.