i try to compare between 2 char* identical strings,but one of them contains a null terminator at the end. i've been looking through the internet and understood that it's not recommendable to remove the null terminator char cause it will make the string unstable. what other methods can i use?
the comparing function:
int StringCompare(const char* str1, const char* str2)
{
int size1 = strlen(str1), size2 = strlen(str2), min = 0, index =0;
bool bigger1 = true;
if(size1>size2)
min=size2;
else
min=size1;
for(index=0;index<min;index++)
{
if(str1[index]>str2[index])
return 1;
if(str1[index]<str2[index])
return (-1);
}
if(size1==size2)
return 0;
if(min==size1)
return (-1);
else
return 1;
}
thanks!