Originally Posted by tidemann for(d=0;d<strlen(cur);d++) Instead of strlen in loop, calculate the length of cur in front of the loop.