hey guys would you plz tell me what is the difference between at() and these [] operators in accessing the characters of string ...which one is better and why??
(at) have "The function automatically checks whether pos is the valid position of a character in the string (i.e., whether pos is less than the string length), throwing an out_of_range exception if it is not."
So, [] will have no error if index more than length, it'll base on location in memory with undefined behavior.
But (at) doesn't.