When I have this piece of code:
int push666 (vector<int> vect){
vect.push_back(666);
}
int main()
{
vector<int> a;
a.reserve(1);
push666(a);
cout << a[0];
return 0;
}
The cout will simply print out some garbage value. It seems like functions don't have a lasting effect on the vector. What can I do about it?