Accessing Array Elements: i vs. .at(i)

  • Topic: C/C++ 
  • Thread starter ineedhelpnow
  • Start date
  • Tags Tags
    Array Elements
1 reply · 2K views · last reply
ineedhelpnow
Messages
649
Reaction score
0
ok I am a little confused.
can both and .at(i) be used to same way to access an array element?
 
The [m].at(n)[/m] function automatically checks whether $n$ is within the bounds of valid elements in the vector, throwing an out_of_range exception if it is not (i.e., if $n$ is greater or equal than its size). This is in contrast with member operator[], that does not check against bounds.