I don't see what would cause you to fail to compile but I see a couple of things you should fix:
- type mismatches. You have
hashreturning anunsigned int, but you don't useunsigned intinside the function or to capture the return value. This is a bug. - You don't NULL Terminate the strings you everytime you use
strcpy; this is a bug. Also strongly advise you not to usestrcpy, but usestrncpyinstead. - You have an odd logical issue where you do a bunch of extra work for no benefit. You copy and lower the string in the
hashfunction, which you just copied and lowercased in thecheckfunction, and then you still usestrcasecmpout incheck.. this is very very very silly. You already do the lowercasing incheck, andloadprior to callinghashsohashhas no need to do it again at all. Additionally it means you don't have usestrcasecmpand can just usestrcmpbecause you've already converted the words. You're welcome. - in your unload just
return i==Nno need for if else there - you might want to consider what
sizeshould be afterunload. yours is definately wrong. You may also consider utilizingsizeas a check that you are freeing everything and there isn't a bug in your logic somewhere. - why do you need
is_loaded? just initialize thecountvariable to 0, grow it and shrink it as needed, now thesizemethod doesnt have to do any logic. ( which it shouldnt have to do) - lastly why read into
bufferonly to have to copy it into anode's storage for the word. Why not just read directly into that storage to start with and avoid the copy?
good luck and hope this helps.