<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-menu-disabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 skin-theme-clientpref-os vector-sticky-header-enabled skin-thumbsize-clientpref-standard" lang="zh" dir="ltr"><head>
    <meta charset="UTF-8">
    <title>Stdlib.h</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" href="./_res_/favicon.png">
    <link rel="canonical" href="https://zh.wikipedia.org/wiki/Stdlib.h"> <link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
    <meta name="ResourceLoaderDynamicStyles" content="">
    <link href="./_mw_/ext.gadget.large-font.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/ext.gadget.text-spacing.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
    <link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
    <link rel="stylesheet" type="text/css" href="./_res_/footer.css">
    <link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
  </head>
  <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Stdlib_h rootpage-Stdlib_h skin-vector-2022 action-view">
    <div class="mw-page-container">
      <div class="mw-page-container-inner">
        <div class="mw-content-container">
          <main id="content" class="mw-body">
            <header class="mw-body-header vector-page-titlebar">
              <h1 id="firstHeading" class="firstHeading mw-first-heading">stdlib.h</h1>
            </header>
            <a id="top"></a>
            <div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
              <div id="contentSub">
                <div id="mw-content-subtitle"></div>
              </div>
              <div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="zh" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="zh" dir="ltr"><p class="mw-empty-elt">
</p>
<style data-mw-deduplicate="TemplateStyles:r84265675">
/* start https://zh.wikipedia.org/ */


.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:" :"}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist-pipe dd::after,.mw-parser-output .hlist-pipe li::after{content:" | ";font-weight:normal}.mw-parser-output .hlist-hyphen dd::after,.mw-parser-output .hlist-hyphen li::after{content:" - ";font-weight:normal}.mw-parser-output .hlist-comma dd::after,.mw-parser-output .hlist-comma li::after{content:"、";font-weight:normal}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:"（"counter(listitem)"\a0 "}.mw-parser-output ul.cslist,.mw-parser-output ul.sslist{margin:0;padding:0;display:inline-block;list-style:none}.mw-parser-output .cslist li,.mw-parser-output .sslist li{margin:0;display:inline-block}.mw-parser-output .cslist li::after{content:"，"}.mw-parser-output .sslist li::after{content:"；"}.mw-parser-output .cslist li:last-child::after,.mw-parser-output .sslist li:last-child::after{content:none}


/* end   https://zh.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r84913072">
/* start https://zh.wikipedia.org/ */


.mw-parser-output .sidebar{width:22em;float:right;clear:right;margin:0.5em 0 1em 1em;background:var(--background-color-neutral-subtle,#f8f9fa);border:1px solid var(--border-color-base,#a2a9b1);padding:0.2em;text-align:center;line-height:1.4em;font-size:88%;border-collapse:collapse;display:table}body.skin-minerva .mw-parser-output .sidebar{display:table!important;float:right!important;margin:0.5em 0 1em 1em!important}.mw-parser-output .sidebar-subgroup{width:100%;margin:0;border-spacing:0}.mw-parser-output .sidebar-left{float:left;clear:left;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-none{float:none;clear:both;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-outer-title{padding:0 0.4em 0.2em;font-size:125%;line-height:1.2em;font-weight:bold}.mw-parser-output .sidebar-top-image{padding:0.4em}.mw-parser-output .sidebar-top-caption,.mw-parser-output .sidebar-pretitle-with-top-image,.mw-parser-output .sidebar-caption{padding:0.2em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-pretitle{padding:0.4em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-title,.mw-parser-output .sidebar-title-with-pretitle{padding:0.2em 0.8em;font-size:145%;line-height:1.2em}.mw-parser-output .sidebar-title-with-pretitle{padding:0.1em 0.4em}.mw-parser-output .sidebar-image{padding:0.2em 0.4em 0.4em}.mw-parser-output .sidebar-heading{padding:0.1em 0.4em}.mw-parser-output .sidebar-content{padding:0 0.5em 0.4em}.mw-parser-output .sidebar-content-with-subgroup{padding:0.1em 0.4em 0.2em}.mw-parser-output .sidebar-above,.mw-parser-output .sidebar-below{padding:0.3em 0.8em;font-weight:bold}.mw-parser-output .sidebar-collapse .sidebar-above,.mw-parser-output .sidebar-collapse .sidebar-below{border-top:1px solid #aaa;border-bottom:1px solid #aaa}.mw-parser-output .sidebar-navbar{text-align:right;font-size:100%;padding:0 0.4em 0.4em}.mw-parser-output .sidebar-list-title{padding:0 0.4em;text-align:left;font-weight:bold;line-height:1.6em;font-size:105%}.mw-parser-output .sidebar-list-title-c{padding:0 0.4em;text-align:center;margin:0 3.3em}@media(max-width:640px){body.mediawiki .mw-parser-output .sidebar{width:100%!important;clear:both;float:none!important;margin-left:0!important;margin-right:0!important}}body.skin--responsive .mw-parser-output .sidebar a>img{max-width:none!important}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-subgroup,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-pretitle,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-heading,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-above,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-below{background:inherit!important;color:inherit!important;border-color:#54595d!important}html.skin-theme-clientpref-night .mw-parser-output .sidebar a:not(.new):not(.mw-selflink):link{color:var(--color-progressive)!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-subgroup,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-pretitle,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-heading,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-above,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-below{background:inherit!important;color:inherit!important;border-color:#54595d!important}html.skin-theme-clientpref-os .mw-parser-output .sidebar a:not(.new):not(.mw-selflink):link{color:var(--color-progressive)!important}}@media print{body.ns-0 .mw-parser-output .sidebar{display:none!important}}


/* end   https://zh.wikipedia.org/ */
</style><table class="sidebar nomobile nowraplinks"><tbody><tr><th class="sidebar-title"><a href="C%E6%A8%99%E6%BA%96%E5%87%BD%E5%BC%8F%E5%BA%AB" title="C標準函式庫">C标准函数库</a></th></tr><tr><th class="sidebar-heading">
一般</th></tr><tr><td class="sidebar-content" style="text-align: left">
<ul><li><a class="mw-selflink-fragment" href="#数据类型">数据类型</a></li>
<li><a href="Ctype.h" title="Ctype.h">字符类型</a></li>
<li><a href="String.h" title="String.h">字符串</a></li>
<li><a href="Math.h" title="Math.h">数学</a></li>
<li><a href="Stdio.h" title="Stdio.h">文件输入/输出</a></li>
<li><a href="Time.h" title="Time.h">日期/时间</a></li>
<li><a href="Locale.h" title="Locale.h">本地化</a></li>
<li><a class="mw-selflink-fragment" href="#函数">内存分配</a></li>
<li><a class="mw-selflink-fragment" href="#函数">过程控制</a></li>
<li><a href="Signal.h" title="Signal.h">信号</a></li>
<li><a href="C%E6%9B%BF%E4%BB%A3%E6%A0%87%E8%AE%B0" title="C替代标记">替代标记</a></li></ul></td>
</tr><tr><th class="sidebar-heading">
杂项</th></tr><tr><td class="sidebar-content" style="text-align: left">
<ul><li><code>&lt;<a href="Assert.h" title="Assert.h">assert.h</a>&gt;</code></li>
<li><code>&lt;<a href="Errno.h" title="Errno.h">errno.h</a>&gt;</code></li>
<li><code>&lt;<a href="Setjmp.h" title="Setjmp.h">setjmp.h</a>&gt;</code></li>
<li><code>&lt;<a href="Stdarg.h" title="Stdarg.h">stdarg.h</a>&gt;</code></li></ul></td>
</tr><tr><td class="sidebar-navbar" style="line-height:1.6"><style data-mw-deduplicate="TemplateStyles:r84244141">
/* start https://zh.wikipedia.org/ */


.mw-parser-output .navbar{display:inline;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:110%;margin:0 8em}.mw-parser-output .navbar-ct-mini{font-size:110%;margin:0 5em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}


/* end   https://zh.wikipedia.org/ */
</style></td></tr></tbody></table>
<p><code><b>stdlib.h</b></code>是<a href="C%E6%A8%99%E6%BA%96%E5%87%BD%E6%95%B8%E5%BA%AB" class="mw-redirect" title="C標準函數庫">C标准函数库</a>的一個<a href="%E5%A4%B4%E6%96%87%E4%BB%B6" title="头文件">头文件</a>，声明了数值与字符串转换函数、<a href="%E4%BC%AA%E9%9A%8F%E6%9C%BA%E6%95%B0" class="mw-redirect" title="伪随机数">伪随机数</a>生成函数、<a href="%E5%8A%A8%E6%80%81%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D" title="动态内存分配">动态内存分配</a>函数、<a href="%E8%BF%9B%E7%A8%8B%E6%8E%A7%E5%88%B6%E5%9D%97" class="mw-redirect" title="进程控制块">进程控制</a>函数等公共函数。 <a href="C%2B%2B" title="C++">C++</a>程序应调用等价的<code>cstdlib</code>头文件.
</p>
<div class="mw-heading mw-heading2"><h2 id="常量"><span id=".E5.B8.B8.E9.87.8F"></span>常量</h2></div>
<p><code>stdlib.h</code>中定义的常量:
</p>
<table border="2" width="100%" cellspacing="4" cellpadding="3" rules="all" style="margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;">

<tbody><tr bgcolor="#e9e9e9">
<th>名字</th>
<th>值</th>
<th>描述
</th></tr>
<tr>
<td><code><a href="NULL" class="mw-disambig" title="NULL">NULL</a></code></td>
<td>一般定义为<code>0</code>, 或<code>0L</code>, 或<code>(void*)0</code></td>
<td>表示<a href="%E7%A9%BA%E6%8C%87%E9%92%88" class="mw-redirect" title="空指针">空指针</a>常量的<a href="%E5%B7%A8%E9%9B%86" title="巨集">巨集</a>; 换句话说，一个常量用来表示一个总是指向无效的内存地址的指针值。
</td></tr>
<tr>
<td><code>EXIT_FAILURE</code></td>
<td>一个非<code>0</code>值</td>
<td>用来指示程序失败的结束，一般用于<code>exit()</code>.
</td></tr>
<tr>
<td><code>EXIT_SUCCESS</code></td>
<td><code>0</code></td>
<td>用来指示程序成功的结束，一般用于<code>exit()</code>..
</td></tr>
<tr>
<td><code>RAND_MAX</code></td>
<td><code>&gt;= 32767</code></td>
<td>函数<code>rand()</code>所能返回的最大的值.
</td></tr>
<tr>
<td><code>MB_CUR_MAX</code></td>
<td></td>
<td>当前locale中多字节字符的最大字节数目
</td></tr></tbody></table>
<div class="mw-heading mw-heading2"><h2 id="数据类型"><span id=".E6.95.B0.E6.8D.AE.E7.B1.BB.E5.9E.8B"></span>数据类型</h2></div>
<p><code>stdlib.h</code>中定义的<a href="%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B" class="mw-redirect" title="数据类型">数据类型</a>：
</p>
<table border="2" width="100%" cellspacing="4" cellpadding="3" rules="all" style="margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;">

<tbody><tr bgcolor="#e9e9e9">
<th>名字</th>
<th>描述
</th></tr>
<tr>
<td><code>size_t</code></td>
<td>算子<code><a href="Sizeof" title="Sizeof">sizeof</a></code>返回结果的数据类型，实际上是无符号整型.
</td></tr>
<tr>
<td><code>div_t</code> ， <code>ldiv_t</code>，<code>lldiv_t</code></td>
<td>函数<code>div</code>, <code>ldiv</code>, <code>lldiv</code>的返回结果的数据类型，实际上是包含两个整数的结构类型.
</td></tr></tbody></table>
<div class="mw-heading mw-heading2"><h2 id="函数"><span id=".E5.87.BD.E6.95.B0"></span>函数</h2></div>
<p><code>stdlib.h</code>中声明的库函数可分为六类：类型转换、伪随机数、动态内存分配与回收管理、进程控制、搜索及排序、简单数学。
</p>
<table border="2" width="100%" cellspacing="4" cellpadding="3" rules="all" style="margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;">

<tbody><tr bgcolor="#e9e9e9">
<th>名字</th>
<th>描述
</th></tr>
<tr bgcolor="#f2f2f2">
<td colspan="2" align="center">类型转换
</td></tr>
<tr>
<td><code>atof</code></td>
<td>把<a href="%E5%AD%97%E7%AC%A6%E4%B8%B2" title="字符串">字符串</a>转换为双精度浮点数。相当于<code>strtod(s, (char**)NULL)</code>.
</td></tr>
<tr>
<td><code>atoi</code></td>
<td>把字符串转换为整型. 相当于<code>(int)strtol(s, (char**)NULL, 10)</code>.
</td></tr>
<tr>
<td><code>atol</code></td>
<td>把字符串转换为长整型. Equivalente a <code>strtol(s, (char**)NULL, 10)</code>.
</td></tr>
<tr>
<td><code>atoll</code></td>
<td>把字符串转换为长长整型. Equivalente a <code>strtol(s, (char**)NULL, 10)</code>. 这是<a href="C99" title="C99">C99</a>新增加的库函数。
</td></tr>
<tr>
<td><code>strtod</code></td>
<td>把字符串转换为双精度浮点数，检查结果是否溢出，并返回字符串不能转换部分的地址.
</td></tr>
<tr>
<td><code>strtof</code></td>
<td>把字符串转换为单精度浮点数，检查结果是否溢出，并返回字符串不能转换部分的地址.
</td></tr>
<tr>
<td><code>strtold</code></td>
<td>把字符串转换为长双精度浮点数，检查结果是否溢出，并返回字符串不能转换部分的地址.
</td></tr>
<tr>
<td><code>strtol</code></td>
<td>把字符串转换为长整型，检查结果是否溢出，并返回字符串不能转换部分的地址.
</td></tr>
<tr>
<td><code>strtoll</code></td>
<td>把字符串转换为<code>long long int</code>，检查结果是否溢出，并返回字符串不能转换部分的地址.
</td></tr>
<tr>
<td><code>strtoul</code></td>
<td>把字符串转换为无符号长整形，检查结果是否溢出，并返回字符串不能转换部分的地址.
</td></tr>
<tr>
<td><code>strtoull</code></td>
<td>把字符串转换为<code>unsigned long long int</code>，检查结果是否溢出，并返回字符串不能转换部分的地址.
</td></tr>
<tr bgcolor="#f2f2f2">
<td colspan="2" align="center">伪随机数序列生成
</td></tr>
<tr>
<td><code>rand</code></td>
<td>返回在0到RAND_MAX之间的伪随机数. 不接受参数作为随机数种子，因此产生的伪随机数列相同，有利于程序调试。
</td></tr>
<tr>
<td><code>srand</code></td>
<td>初始化<code>rand()</code>接受无符号整型参数作为伪随机数种子.如果种子相同，伪随机数列也相同。
</td></tr>
<tr bgcolor="#f2f2f2">
<td colspan="2" align="center">内存的分配与释放
</td></tr>
<tr>
<td><code>aligned_alloc</code></td>
<td>边界对齐的动态内存分配.
</td></tr>
<tr>
<td><code>calloc</code></td>
<td>数组的动态内存分配，且初始化为全零
</td></tr>
<tr>
<td><code>malloc</code></td>
<td>动态内存分配，其内容不初始化
</td></tr>
<tr>
<td><code>realloc</code></td>
<td>释放老的动态内存块，按照给出的尺寸分配新的动态内存块，老的内存块的内容尽量复制到新的内存块
</td></tr>
<tr>
<td><code>free</code></td>
<td>系统释放动态分配的内存. 如果是空指针，则无动作发生；如果指针所指不是动态分配的内存块或者是已释放的内存块，则行为是未定义的。
</td></tr>
<tr bgcolor="#f2f2f2">
<td colspan="2" align="center">进程控制/与运行环境的沟通
</td></tr>
<tr>
<td><code>abort</code></td>
<td>导致程序非正常的结束，各种流缓冲区与临时文件直接放弃。实际上抛出<code>raise(SIGABRT)</code>，缺省的信号处理行为是使用退出代码3执行终止（terminate）操作。如果<code>SIGABRT</code>被捕捉且信号处理程序不返回，则程序将不终止.
</td></tr>
<tr>
<td><code>atexit</code></td>
<td>登记一个函数，当程序使用<code>exit</code>正常退出时被登记的函数自动被调用.
</td></tr>
<tr>
<td><code>exit</code></td>
<td>程序正常终止。首先<code>atexit()</code>登记的函数按照登记的逆序被调用；如果多次调用<code>atexit</code>登记了多个函数，按照登记的逆序调用这些函数。如果一个函数被登记了多次，则程序正常退出时该函数也将被调用多次。然后所有缓冲区中的数据被写回(flushed)；所有打开着的流被关闭；<code>tmpfile</code>函数创建的文件被删除。最后，控制权返回给调用环境，返回数值表示程序返回时的状态，0表示<code>EXIT_SUCCESS</code>, 1表示<code>EXIT_FAILURE</code>.
</td></tr>
<tr>
<td><code>at_quick_exit</code></td>
<td>登记一个函数，当程序使用<code>quick_exit</code>正常退出时被登记的函数自动被调用.
</td></tr>
<tr>
<td><code>_Exit</code></td>
<td>程序正常终止, 但<code>atexit()</code>, <code>at_quick_exit()</code>, <code>signal()</code>登记的函数不被调用; 打开的流、文件是否被关闭，由编译器的实现者决定
</td></tr>
<tr>
<td><code>getenv</code></td>
<td>获得某一个环境变量的字符串值，如果该环境变量不存在，返回<code>NULL</code>.
</td></tr>
<tr>
<td><code>quick_exit</code></td>
<td>程序正常终止, 但<code>atexit()</code>, 登记的函数不被调用; <code>at_quick_exit()</code>登记的函数按登记顺序的逆序被调用。
</td></tr>
<tr>
<td><code>system</code></td>
<td>把参数作为外部环境的命令执行。 如果参数为空，则判断外部环境是否有命令解释器。
</td></tr>
<tr bgcolor="#f2f2f2">
<td colspan="2" align="center">搜索与排序
</td></tr>
<tr>
<td><code>bsearch</code></td>
<td>折半搜索.
</td></tr>
<tr>
<td><code>qsort</code></td>
<td>排序.
</td></tr>
<tr bgcolor="#f2f2f2">
<td colspan="2" align="center">整数算术
</td></tr>
<tr>
<td><code>abs, labs, llabs</code></td>
<td>计算整数的绝对值.
</td></tr>
<tr>
<td><code>div, ldiv, lldiv</code></td>
<td>计算整数除法的商与余数.
</td></tr>
<tr bgcolor="#f2f2f2">
<td colspan="2" align="center">多字节字符/宽字符转换
</td></tr>
<tr>
<td><code>mblen</code></td>
<td>计算多字节字符的长度并确定是否为有效字符  .
</td></tr>
<tr>
<td><code> mbtowc</code></td>
<td>多字节字符转换为宽字符.
</td></tr>
<tr>
<td><code> wctomb</code></td>
<td>宽字符转换为多字节字符.
</td></tr>
<tr bgcolor="#f2f2f2">
<td colspan="2" align="center">多字节字符串/宽字符串转换
</td></tr>
<tr>
<td><code> mbstowcs</code></td>
<td>多字节字符串转换为宽字符串.
</td></tr>
<tr>
<td><code> wcstombs</code></td>
<td>宽字符串转换为多字节字符串.
</td></tr></tbody></table></div><!--htdig_noindex--><div><div class="zim-footer">
    This article is issued from <a class="external text" title="Last edited on 2024-06-07" href="https://zh.wikipedia.org/wiki/?title=Stdlib.h&amp;oldid=82949308">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
            </div>
          </main>
        </div>
      </div>
    </div>
     <script src="./_webp_/webpHandler.js"></script>
  

</body></html>