Often, people look for something complicated when it's the simple things. ;-)
Assuming you did a direct cut and paste, the first problem is very simple. You have a typo.
hahvalue=tolower(new_node->word[0])-96;
^
It shoud be HASvalue, not HAHvalue. [emphasis added] I am assuming that you have the correct include to support tolower()?
Next, your function prototype needs work. What is the variable type for the parameters being passed?
int hash(<type> new_node->word)
I would also recommend a change. It looks like you're passing in an element of a structure. Make it simpler and replace new_node->word
with something simpler, like word
and give it the same type as word
from the node structure. For example:
int hash( char* word )
However, Mojitaba1 does have a better suggestion. It looks like you're trying to pass a structure element to the function - two levels removed from what you want to hash. Instead of passing that, the hash function would be more flexible if you simply passed the letter to be hashed. Here is an example of the call to the function,
int wordhash = hash(new_node->word[0]);
followed by the structure of the hash function.
int hash(char letter)
{
int hashvalue;
hashvalue=tolower(letter)-96;
return hashvalue;
}
When debugging compiler errors, it helps to look very carefully at what the error says and exactly where it's indicating the problem is on the line of code causing the error.
Typos and syntax errors are common problems when programming, especially when you start out. Don't worry, it gets easier with time and practice. We all went through it.
Here's a heads-up. You should incorporate a special case into your function to handle apostrophes.
If this answers your question, please accept this answer to close the question. Let's keep up on forum maintenance. ;-)