The loop that begins on line 11 of the code you posted: where in that loop do you increment g to point to the next node in the linked list? Don't you want something like this?
while(g != NULL)
{
... <snip>
g = g->next;
}
Also I don't see any need to save the original parameter pointer because it is never used again in that function. You could just deleteg and use t instead.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343