Which of the following is a true statement about the difference between pointers and iterators?

Advertisement

  • While pointers are variable that hold memory address, iterators are generic functions used to traverse containers. These function allows the programmer to implement read and write code as the container is traversed.
  • Incrementing an iterator always means access the next element in the container(if any), no matter the container. Incrementing the pointer means pointing to the next element in memory, not always the next element.
  • Pointers are variables that hold memory address where as iterator are unsigned integers that refers to offsets in arrays.
  • All iterator are implemented with pointers so all iterators are pointers but not all pointers are iterators.
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend