Originally Posted by
simpatico_qa
Could someone suggest the code modifications to make to achieve that?
This is where C starts to seem obscure. You need to pass a pointer to a pointer and then dereference it in the function, eg:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct this {
char *ptr;
};
void test2 (char **ptr) {
*ptr=malloc(12);
strcpy(*ptr,"hello world");
}
void test1 (struct this *ptr) {
test2(&ptr->ptr);
}
int main () {
struct this that;
test1(&that);
printf("%s\n",that.ptr);
return 0;
}
So going back to your example, the prototype for eQ would be:
Code:
void eQ(List** l, Vertex* v);
and in "connect"
Code:
eQ(&v->adj, u); eQ(&u->adj, v);
Get it?