I have read that use of strlen is more expensive than such testing like this:
strlen
We have a string x 100 characters long.
x
I think that<
I can suppose that in first variant you find strlen each iteration, while in second variant you don't do that. Try this to check:
int a = strlen(x); for (int i = 0; i < a; i++) {...}