Friday, July 31, 2009

Write a program in c for strcmpi without using library function with pointers?

iam serching job somany comapnies asking this question but iam not getting lz reply anybody

Write a program in c for strcmpi without using library function with pointers?
int strcmpi(const char *s1, const char *s2)


{


for (;;){


if (*s1 != *s2) {


int c1 = toupper((unsigned char)*s1);


int c2 = toupper((unsigned char)*s2);





if (c2 != c1) {


return c2 %26gt; c1 ? -1 : 1;


}


} else {


if (*s1 == '\0') {


return 0;


}


}


++s1;


++s2;


}


}
Reply:is it c++ ?
Reply:You can't. You have to use libraries.


No comments:

Post a Comment