I just starting to learning vectors and little confused about size() and capacity() I know little about both of them. But why in this program both
size()
capacity()
It is for efficiency so that it does not have to expand the underlying data structure each time you add an element. i.e. not having to call delete/new each time.
delete
new