Accessing out of bound index in array in Rust - compile vs runtime error?

后端 未结 0 529
轻奢々
轻奢々 2020-12-21 03:15

I\'m reading The Rust book and I run across this example:

fn main() {
    let a = [1, 2, 3, 4, 5];
    let index = 10;

    let element = a[index];

    print         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题