The book says that std::array
is safer and simpler than other methods of the assignment.
Here's my code:
#include<iostream>
#include<array>
using namespace std;
int main(){
array<int,5> a = {1,2,3,4,5};
a.at(-2)=100;
cout<<a[-2]<<endl;
return 0;
}
Why is there no warning or error in this code?
Aucun commentaire:
Enregistrer un commentaire