954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Search a Hash table

Hi

I have a rather quick but very important question.
I need to search a hash table for a value named element, whenever this value is found in the table, the search function should increase the counter for that element. My code is not working... any help is appreciated

void HashF10::searchTable(const ElementF10 holdVal) 
{
     int i = hashElement ( holdVal );
     int leng = strlen(holdVal);
     while ( hashTable[i].element != NULL ) 
     {
         if ( strcmp ( hashTable[i].element, holdVal ) == 0 )
             hashTable[i].count++;//return FOUND;
         else
             i = ( i + 1 );
     }
}
schoolboy2010
Light Poster
41 posts since Jan 2010
Reputation Points: 10
Solved Threads: 1
 

I fixed the problem... my logic was wrong for that code. Thanks if you tried to help.

schoolboy2010
Light Poster
41 posts since Jan 2010
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: