I am writng a fucntion that Compares two strings alphabetically, case-INsensitive.
The instructions are :
* Copy the two strings to local buffers (arrays), change both string *COPIES to upper case; Compare the two strings using myStrCmp().
Code:
int myStrBlindCmp(unsigned char change_one[], unsigned char change_two[])
{
}
is what i have
i know that to change to uppercase would look like this:
Code:
// To Uppercase
for ( x=0; string[x] != '\0'; ++x)
if ( string[x] >= 'a' && string[x] <= 'z')
string[x] = string[x] - (32);
and myStrCmp looks like this:
Code:
int myStrCmp (unsigned char one[],unsigned char two[])
{
int i=0,x=0;
while (one[i]==two[i] && one[i] != '\0' && two[i] != '\0')
++i;
if (one[i] == '\0' && two[i] =='\0')
x=0;
else
if (one[i] > two[i] )
x=1;
else
x= -1;
return (x);
}
but how do you copy to local buffers and put this all together???