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 );
     }
}

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.