Yes your second may not work 100% percent of the time but it would be slighty quite. This is because when using strlen() you have to call the method each time. A better way would be like so
int strLength = strlen(x);
for (int i = 0; i < strLength; i++)