In any case, it is probably trivial. However, you could approach it like this:
Originally Posted by Epy
That's a bad idea because now strlen is called everytime, so it is much better to use an extra variable assignment (presuming the strlen isn't going to change):
for (i=0; i<strlen(whatever); i++)
In other words, if you have a block or a loop or a function that is getting called hundreds of times with a cast in it that could be replaced with a single temp variable, then maybe it is worth it.
int x = strlen(whatever);
for (i=0; i<x; i++)
But pretty sure most casts are way less expensive than strlen() calls...I don't think you need to sweat about it too much.