Skip to content

Instantly share code, notes, and snippets.

Created June 18, 2009 08:39
Show Gist options
  • Save anonymous/131789 to your computer and use it in GitHub Desktop.
Save anonymous/131789 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <vector>
using namespace std;
vector<int> p;
int main()
{
for(int i=0;i<10;i++)
p.push_back(i);
vector<int>::iterator it=p.begin();
while(it!=p.end())
{
cout<<*it<<endl;
it++;
}
cout<<&*(it-1)<<endl;
cout<<&p[9]<<endl;
p.push_back(13);
cout<<&p[9]<<endl;
cout<<&*(it-1)<<endl;//當機
if(it==p.end())
cout<<"??"<<endl;//還是當機
system("PAUSE");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment