找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 922|回复: 3
收起左侧

请教Dev-C++ 5.11 如何查看strncmp库函数原型?感谢帮忙

[复制链接]
ID:1025655 发表于 2022-11-11 16:12 | 显示全部楼层 |阅读模式
如题,如下图,如何能查看strncmp()的函数体?

截图

截图

回复

使用道具 举报

ID:883242 发表于 2022-11-11 17:41 | 显示全部楼层
想看gcc的库源码,下载glibc慢慢看呗。
回复

使用道具 举报

ID:155507 发表于 2022-11-11 23:08 | 显示全部楼层
程序分享出来给需要的人作参考

  1. /* strncmp -- compare two strings, stop after n bytes.
  2.    This function is in the public domain.  */

  3. /*
  4. @deftypefn Supplemental int strncmp (const char *@var{s1}, @
  5.   const char *@var{s2}, size_t @var{n})
  6. Compares the first @var{n} bytes of two strings, returning a value as
  7. @code{strcmp}.
  8. @end deftypefn
  9. */

  10. #include <ansidecl.h>
  11. #include <stddef.h>

  12. int
  13. strncmp(const char *s1, const char *s2, register size_t n)
  14. {
  15.   register unsigned char u1, u2;

  16.   while (n-- > 0)
  17.     {
  18.       u1 = (unsigned char) *s1++;
  19.       u2 = (unsigned char) *s2++;
  20.       if (u1 != u2)
  21.         return u1 - u2;
  22.       if (u1 == '\0')
  23.         return 0;
  24.     }
  25.   return 0;
  26. }
复制代码
回复

使用道具 举报

ID:1025655 发表于 2022-11-15 09:52 | 显示全部楼层
angmall 发表于 2022-11-11 23:08
程序分享出来给需要的人作参考

感谢!但不是我想要的!我要的是方法!那么多库函数呢!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表