C++ Vector resize()
It modifies the size of the vector to the specified value
Size changed to 4 and new value is
Consider a vector v. Syntax would be:
n : It is the new vector size.
val : If n is greater than the current vector size, then value(val) is inserted in the added space.
It does not return any value.
Let's see a simple example when n is less than the current vector size.
Initial elements are: 1 2 3 4 5 6 7 8 9 10 After resizing its size to 5, elementsare: 1 2 3 4 5
Let's see a simple example n is greater than the current vector size.
Elements of v1 are :java C C++ java C C++ .Net .Net
Next TopicC++ Vector
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected]
Duration: 1 week to 2 week