len1 and len2 do exactly the same thing. The same code with different variable names does not differ in any significant way.
1 2 3 4 5 6 7 8 9 10 11
float len1(char *sss)
{
int c=0;
while (*sss!='\0')
{
c++;
*sss++;
}
return c;
}
What I'm wondering is why you're returning a float type? Do you expect that the length may be negative or some fractional value of a whole number at some point? What is the significance of the asterisk on line 7?
Presumably you have some algorithm for determining similarity. Currently all you are doing is checking if the beginning of the strings are the same, so what you need to do to fix that is make your code conform to the algorithm you should be using.