Ok, If your code is clear it will most likely help you find your way. Any code I help on gets formatted to my liking which helps me understand and correct problems.
Take your calcuation for string length out of the loop. It won't matter for code speed here but build good habits.
strl1 = strlen(str1);
strl2 = strlen(str2);
Your comparison is mixed. x will always be larger. Try 'x < strl1', in English 'Do the code in the brackets because this comparison of x < strl1 is still true'.
Do the same in the other loop.
Get rid of 'n',break(only in the for loop) declare all variables.
Look up 'gets' and find out why you should replace it with 'fgets'.
Try all this and post the working code
This post has been edited by Ambercroft: 12 May, 2008 - 06:43 PM