#include
#include
#include
int my_strcmp(const char* dest, const char* src)
{
assert(dest);
assert(src);
while (*dest)
{
if (*dest == *src)
{
dest++;
src++;
}
else
{
return *dest - *src - '\0';
}
}
return 1;
}
int main()
{
char arr1[] = "helloaworld!";
char arr2[] = "hello";
int ret = my_strcmp(arr1, arr2);
if (ret == 1)
{
printf("match success!");
}
else
{
printf("match failure!\n");
printf("%d", ret);
}
system("pause");
return 0;
}