Will the strlen() function below get called just once (with the value stored for further comparisons); or is it going to be called every time the comparison is performed?
It will be evaluated for every iteration of the loop (edit: if necessary).
Like Tatu said, if word
isn't going to change in length, you could do the strlen
call before the for loop. But as Chris said, the compiler may be good enough to realize that word
can't change, and eliminate the duplicate calls itself.
But if word
can change in length during the loop, then of course you'll need to keep the strlen
call in the loop condition.