前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >不同的strcmp

不同的strcmp

作者头像
梦里茶
发布2017-12-29 16:41:20
9890
发布2017-12-29 16:41:20
举报
文章被收录于专栏:梦里茶室梦里茶室

Android libc中的strcmp

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

代码语言:txt
复制
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

代码语言:txt
复制
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);
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2015-10-23 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档