Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Latest commit

 

History

History
20 lines (15 loc) · 662 Bytes

max_size.md

File metadata and controls

20 lines (15 loc) · 662 Bytes

max_size

Description :

  • Returns the maximum number of elements that a vector can hold.
  • Depends on the limitations of the system on which program is running.

Example:

	//Create two vectors, one empty and one having 6 elements
	std::vector<int> vector1;
	std::vector<int> vector2{10, 30, 30, 40, 50, 60};
	
	//Display the maximum number of elements both can hold
	std::cout << "The maximum size of vector1 is: " << vector1.max_size() << std::endl;
	std::cout << "The maximum size of vector2 is: " << vector2.max_size() << std::endl;

See Sample Code Run Code