MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/stl/vector.cpp:9–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#define endl '\n'
8
9int main(){
10 cin.tie(0)->sync_with_stdio(0);
11 vector<int> v;
12 v.pb(1);
13 v.emplace_back(2);
14 cout<<v[0]<<endl;
15 //vector or pair
16 vector<pair<int,int>> vec;
17 vec.pb({1,2});
18 vec.emplace_back(1,2);
19 cout<<vec[0].first<<" "<<vec[0].second<<endl;
20 //iterator of the vector
21 vec.pb({12,32});
22 vector<int>::iterator it=v.begin();
23 it++;
24 cout<<*it<<" "<<*it;
25 //initializing vector
26 vector<int> v1(5);//vector with 5 value (0)
27 vector<int > v2(5,43);//vector with 5 value that is 43 each
28 vector<int >::iterator it1=v.end();
29 vector<int >::iterator it2=v.rend();
30 vector<int >::iterator it3=v.rbegin() ;
31
32
33
34
35
36 return 0;
37}
38
39

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected