Hash Tabel linked lists in C

Write here if you have problems with your C source code

Moderator: Board moderators

Hash Tabel linked lists in C

Postby koodeGuru » Sun May 02, 2004 1:51 am

I am trying to implement a hash table where each hashtable element is a pointer to a linked list of strings. Here is what my code looks like
Code: Select all
cod removed.........

I am getting lot of errors and started learning c just few days ago . I get this error:
passing arg 2 of `insertSchool' makes integer from pointer without a cast
and also some other errors.

What am I supposed to do now?How do I pass sname to the insertName method to insert it into the string?
Some one please help. Thanks.
Last edited by koodeGuru on Tue May 04, 2004 9:13 am, edited 1 time in total.
koodeGuru
New poster
 
Posts: 23
Joined: Mon Apr 19, 2004 6:24 am

oops

Postby koodeGuru » Sun May 02, 2004 1:58 am

I forgot to mention that:
Code: Select all
variable [b]distArray[/b] stores hashTable elements which are ints
[/b]
koodeGuru
New poster
 
Posts: 23
Joined: Mon Apr 19, 2004 6:24 am

Postby Krzysztof Duleba » Sun May 02, 2004 2:53 am

I think you should try to write something easier. Much easier. You have so many bugs in code and you can't even understand compiler's messages.

Few hints:
In struct node, you should have
[c]char name[MAX_CHARACTERS];[/c]or[c]char *name;[/c]not a mix.

Function insertName should take (int, char *) as arguments.

In main(), you should return 0 at the end.

If you declared insertName as void, then you must define it as void too (otherwise insertName is int by default).

You can't assign strings with operator=. Use strcpy() instead.
User avatar
Krzysztof Duleba
Guru
 
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland

never mind

Postby koodeGuru » Mon May 03, 2004 6:45 am

I fixed it. Thanks for your help though. :D
koodeGuru
New poster
 
Posts: 23
Joined: Mon Apr 19, 2004 6:24 am


Return to C

Who is online

Users browsing this forum: No registered users and 1 guest