Code:
struct node{
string location;
int gval;
int fval;
node *next;
};
Code:
struct node *hp;
for(int i = 0; i<graph.size();i++)
{
cout << graph[i].location <<"=="<<graph[0].location<<"?\n";
if((graph[i].location).compare(start)==0)
{
index = i;
break;
}
}
cout<<"Found "<< graph[index].location;
//make starting nodes
hp = (struct node*)(malloc(sizeof(struct node)));
hp->location = graph[index].location;
For some reason the cout produces output fine with the string value of graph[index].location but when I debug my program, it crashes right at
Code:
hp->location = graph[index].location;
Also graph is defined as
Code:
vector<vertice> graph = initializeGraph();
Code:
struct Edge
{
string destination;
int weight;
};
struct vertice
{
string location;
vector<Edge> directions;
};
Graph is a vector of vertice. Also when I am in the debugger, and I try to track the value of graph[i].location in the for loop, I get
Code:
graph[i].location CXX0058: Error: overloaded operator not found