Are iterators only for containers?

do iterators only works for containers or they can also work on array or string ???

hello @anujsharmabadboy

for array u can simply store base address in pointer and then keep incremention pointer by 1 for iterting the array.

u can use iterator over c++ string

string is a class of container that’s why we can use iterator for string right ??
i mean can iterators be used over non-class containers ???

yes…

no…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.