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

后端 未结 0 546
醉酒成梦
醉酒成梦 2020-12-21 03:20

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         


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