I have the following code:
int compare(string a,string b)
{
int length=a.length();
for(int i=0; i < length; i++)
{
if(a[i]<b[i])
return 1;
if(a[i]>b[i])
return 0;
}
....
}
I'm interesting in the cases when length of string a is bigger than length of string b and string a starts with string b.
Example:
string a="abcdefghi"
string b="abcde"
The function will return 0. I want to know if there is any chance for this function to return 1; in this conditions.