Why Vector's size() and capacity() is different after push_back()

前端 未结 6 728
鱼传尺愫
鱼传尺愫 2021-01-03 00:09

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

6条回答
  •  独厮守ぢ
    2021-01-03 00:51

    Size() returns how many values you have in the vector.

    And capacity() returns size of allocated storage capacity means how many values it can hold now.

提交回复
热议问题