If I may ask a related pointers question:
Code:
void eQ(List* l, Vertex* v){
List* new = malloc(sizeof(List*)); new->v = v;
if (l == NULL) l = new;
else{
List* temp = l;
while (temp->next != NULL) temp = temp->next;
temp->next = new;
}
}
void connect(Vertex* v, Vertex* u){
int i = vIndex(v); int j = vIndex(u);
AC[i][j] = 1; AC[j][i] = 1;
eQ(v->adj, u); eQ(u->adj, v);
}
Now unfortunately exiting eq(..) v->adj and u->adj remain unchanged pointing to null. I know of the solution: v->adj = eQ(v->adj, u) but I'd like to get the 'pointers' solution to work as well. Could someone suggest the code modifications to make to achieve that?
PS: The structures referred to here are posted in my other thread of the day 'Deadlock prevention in C'