I did my anagram solver differently. I wanted a C program where I could re-use the code elsewhere. I find the library functions strlen, strlwr, and memset efficient enough. It's surprising how often something I did for fun contains a bit of tricky code that I can apply to work later on. If I was ambitious, I'd substitute the array arithmetic var[index] to code using pointers.
It's amazing how may approaches there can be to perform a similar bit of work.
Cheers, PW.
P.S.
Zero fill a 26 element array of integers.
Load the array by bumping the count for each letter in the jumbled string.
FOR (each word in the dictionary) IF (length matches) Zero fill a second 26 element array of integers. Load the dictionary word into the array similarly to the jumbled word. Print words when arrays match. . . . /* A bit (the testing part) from the actual code */
if (gl!=strlen(w)) return(0); /* Test the length */ memset(wa,0,AL); /* Zero fill arrays */ for (a=0;a<gl;a++) ++wa[w[a]-FL]; /* Count characters */ for (a=0;a<AL;a++) if (ga[a]!=wa[a]) return(0); /* Compare arrays */ return(-1); /* Pass if not fail */