#include<bits/stdc++.h>
#define MAX 20
using namespace std;
int main()
{
//Creating a vector
vector <int> v;
std::vector<int>::iterator vIterator;
int i;
for(i=1;i<MAX;i++)
{
v.push_back(i);
}
cout<<"Numbers:"<<endl;
for(vIterator = v.end();vIterator>v.begin();vIterator--)
{
cout<<*vIterator<<endl;
}
int el_count = v.size();
cout<<"Size="<<el_count;
return 0;
}
Here's the output of the code:
Numbers: 0 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 Size=19
Why am I getting this "0" at the start? And why does my list begin with a 2?