I was taught string::at in school, but by exploring the string library I saw string::operator[], which I was never shown before.
string::at
string::operator[]
I\'m now u
at does bounds checking, exception of type std::out_of_range will be thrown on invalid access.
std::out_of_range
operator[] does NOT check bounds and thus can be dangerous if you try to access beyond the bounds of the string. It is a little faster than at though.
at