max_size(): It is a build-in function in STL. It returns the size() of the
largest possible vector.
File: stl_vector.h
Parameter: No parameters are required for this function.
Syntax:
vecName.max_size()
For Example:
vec = {1,2,3,4}
vec.max_size() = > It retuns max size (4611686018427387903).
Approach
C++
#include <bits/stdc++.h>using namespace std;int main(){vector<int> vec = {1, 2, 3, 4};//prints the maximum size of vectorcout << vec.max_size() << "\n";return 0;}
No comments:
Post a Comment