首页 > 其他 > 详细

不同的strcmp

时间:2015-10-23 16:22:13      阅读:257      评论:0      收藏:0      [点我收藏+]

Android libc中的strcmp

https://android.googlesource.com/platform/bootable/bootloader/legacy/+/donut-release/libc/strcmp.c

int strcmp(const char *a, const char *b)
{
  while(*a && *b) {
  if(*a++ != *b++) return 1;
  }
  if(*a || *b) return 1;
  return 0;
}

ios中libc中的strcmp

http://www.opensource.apple.com/source/Libc/Libc-262/ppc/gen/strcmp.c

int strcmp(const char *s1, const char *s2)
{
  for ( ; *s1 == *s2; s1++, s2++)
  if (*s1 == ‘\0‘)
  return 0;
  return ((*(unsigned char *)s1 < *(unsigned char *)s2) ? -1 : +1);
}

不同的strcmp

原文:http://www.cnblogs.com/hellocwh/p/4904668.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!