The following program keeps crashing and I can't figure out what's wrong. It seems that v is somehow not available in the main function..
#include <iostream>
#include <vector>
using namespace std;
vector<string> *asdf()
{
vector<string> *v = new vector<string>();
v->push_back("blah");
v->push_back("asdf");
return v;
}
int main()
{
vector<string> *v = NULL;
v = asdf();
for (int i=0; i<(v->size()); v++) {
cout << (*v)[i] << endl;
}
delete v;
return 0;
}