B
Bin Chen
Hi,
I don't know what's wrong with my program, it causes SIGSEGV:
#include <vector>
using namespace std;
int main(void)
{
vector<int> v;
vector<int>::iterator iter;
int i,j,k;
i = 9;j = 10;k = 11;
v.push_back(i);
v.push_back(j);
v.push_back(k);
for (iter = v.begin();iter != v.end(); ++iter) {
printf("*********%d\n", *iter);
iter = v.erase(iter);
}
return 0;
}
Thanks.
ABAI
I don't know what's wrong with my program, it causes SIGSEGV:
#include <vector>
using namespace std;
int main(void)
{
vector<int> v;
vector<int>::iterator iter;
int i,j,k;
i = 9;j = 10;k = 11;
v.push_back(i);
v.push_back(j);
v.push_back(k);
for (iter = v.begin();iter != v.end(); ++iter) {
printf("*********%d\n", *iter);
iter = v.erase(iter);
}
return 0;
}
Thanks.
ABAI