strcmp

20/07/2009 ·


//comparing s1 and s2; return 0 if strings are equal and number when they are not equal
int strcmp(const char *s1, const char *s2)
{
while (*s1==*s2 )
{
if(*s1=='\0') return 0;
s1++;s2++;
}
return(*s1-*s2);
}

0 comments:

Post a Comment

Submit Request

If you need some code or programs just post a comment on this post. I will try to provide you the same at the earliest.

About this blog

Free sample code, example code , code snippet , tutorials in C C++. Find, download and reuse the code database available which vary from small programs to large ones as well. Feel free to request for code that is not in the list.

Followers