Tuesday 11 December 2012

Implement strcasecmp

/*This function will comapre two string without cases and returns 0 if they are same or the difference of the ascii value if they are difference*/
int mystrcasecmp(const char *s1, const char *s2)
{
while(*s1!='\0' && *s2!='\0'){
if(toupper(*s1) && toupper(*s2)){
s1++;
s2++;
}
else
return(*s1-*s2);
}
return (*s1 - *s2);
}

No comments:

Post a Comment