Thread: pointer error
View Single Post
Old 07-13-2006, 08:39 AM   #5 (permalink)
ron76
Registered User
 
Join Date: Jul 2006
Posts: 9
ron76 is on a distinguished road
ok I think where my problem is coming. Here is the thing. this is an array of linked lists.
So when I go to that array node. and pass a string to add to that node. Im getting the following erroe when the function accepts the node as input argument.

Let me show what I mean:

Code:
// while decalring
Node *List[MAX]

// call from main
//if that linked list in that array element is empty 
if (List[bucket] == NULL)
    addhead(string,);

Node *addhead(char *string, Node *temp)
{
	Node *new = newNode(string);

	Node *head = NULL;

    printf("\n node /t %s", temp);

    head = new;
    printf("\n List /t %s", new);	
     return (new);
}

Node *newNode(char *string)
{
	Node *newNode;

	strcpy(newNode->string,strtok(string, " "));
	newNode->next = NULL;
	return(newNode);
}
This is the warning I get for the bold lines above:
warning: char format, Node arg (arg 2)

If I were to print what is the content of List[bucket] from the main class, I do get its contents. But from the function it does not work.

Please help.
ron76 is offline   Reply With Quote