<!DOCTYPE html PUBLIC "‐//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">     <html
xmlns="http://www.w3.org/1999/xhtml"> <head>
    <link            rel="stylesheet"             type="text/css"
href="../../../style.css" title="style" />
    <link  rel="stylesheet"  type="text/css"  href="../style.css"
title="style" />
    <meta             http‐equiv="content‐type"              con‐
tent="text/html;charset=utf‐8" />

    <title>stdlib.h.0p ‐ Linux manual page</title> </head>

<body>

<div        class="page‐top"><a       id="top_of_page"></a></div>
<!‐‐%%%TOP_BAR%%%‐‐> <!‐‐%%%PAGE_START%%%‐‐>

<table class="sec‐table"> <tr>
    <td>
        <p class="section‐dir"> <a href="#PROLOG">PROLOG</a> | <a
href="#NAME">NAME</a>  |  <a  href="#SYNOPSIS">SYNOPSIS</a>  | <a
href="#DESCRIPTION">DESCRIPTION</a> |  <a  href="#APPLICATION_US‐
AGE">APPLICATION&nbsp;USAGE</a>   |  <a  href="#RATIONALE">RATIO‐
NALE</a>   |   <a    href="#FUTURE_DIRECTIONS">FUTURE&nbsp;DIREC‐
TIONS</a>    |   <a   href="#SEE_ALSO">SEE&nbsp;ALSO</a>   |   <a
href="#COPYRIGHT">COPYRIGHT</a>
        </p>
    </td>
    <td class="search‐box">
        <div class="man‐search‐box">

            <form                method="get"                 ac‐
tion="http://www.google.com/search">
                <fieldset class="man‐search">
                    <input    type="text"    name="q"   size="10"
maxlength="255" value="" />
                    <input type="hidden"  name="sitesearch"  val‐
ue="man7.org/linux/man‐pages" />
                    <input  type="submit" name="sa" value="Search
online pages" />
                </fieldset>
            </form>

        </div>
    </td>
    <td> </td> </tr> </table>

<pre> <span class="headline">stdlib.h(0P)              POSIX Pro‐
grammer’s  Manual              stdlib.h(0P)</span>  </pre> <h2><a
id="PROLOG" href="#PROLOG"></a>PROLOG  &nbsp; &nbsp; &nbsp;  &nb‐
sp;        <a        href="#top_of_page"><span        class="top‐
link">top</span></a></h2><pre>
       This manual page is part of the POSIX Programmer’s Manual.
The Linux
       implementation of this interface may differ (consult the
       corresponding  Linux  manual page for details of Linux be‐
havior), or
       the interface may not be  implemented  on  Linux.   </pre>
<h2><a id="NAME" href="#NAME"></a>NAME  &nbsp; &nbsp; &nbsp; &nb‐
sp;        <a        href="#top_of_page"><span        class="top‐
link">top</span></a></h2><pre>
       stdlib.h  —  standard  library  definitions  </pre> <h2><a
id="SYNOPSIS" href="#SYNOPSIS"></a>SYNOPSIS  &nbsp; &nbsp; &nbsp;
&nbsp;       <a       href="#top_of_page"><span       class="top‐
link">top</span></a></h2><pre>
       #include &lt;stdlib.h&gt; </pre>  <h2><a  id="DESCRIPTION"
href="#DESCRIPTION"></a>DESCRIPTION   &nbsp; &nbsp; &nbsp; &nbsp;
<a             href="#top_of_page"><span              class="top‐
link">top</span></a></h2><pre>
       Some of the functionality described on this reference page
extends
       the ISO C standard. Applications shall define  the  appro‐
priate feature
       test   macro   (see   the   System  Interfaces  volume  of
POSIX.1‐2008, <i>Section</i>
       <i>2.2</i>, <i>The Compilation Environment</i>) to  enable
the visibility of these
       symbols in this header.

       The  <i>&lt;stdlib.h&gt;</i>  header shall define the fol‐
lowing macros which shall
       expand to integer constant expressions:

       EXIT_FAILURE
                   Unsuccessful  termination  for  <i>exit</i>();
evaluates to a non‐
                   zero value.

       EXIT_SUCCESS
                   Successful   termination   for  <i>exit</i>();
evaluates to 0.

       {RAND_MAX}  Maximum value returned  by  <i>rand</i>();  at
least 32767.

       The  <i>&lt;stdlib.h&gt;</i>  header shall define the fol‐
lowing macro which shall
       expand  to  a  positive  integer  expression   with   type
<b>size_t</b>:

       {MB_CUR_MAX}
                   Maximum  number of bytes in a character speci‐
fied by the
                   current locale (category <i>LC_CTYPE</i>).

       The <i>&lt;stdlib.h&gt;</i> header shall  define  NULL  as
described in <i>&lt;stddef.h&gt;</i>.

       The  <i>&lt;stdlib.h&gt;</i>  header shall define the fol‐
lowing data types through
       <b>typedef</b>:

       <b>div_t        </b>Structure   type   returned   by   the
<i>div</i>() function.

       <b>ldiv_t        </b>Structure   type   returned   by  the
<i>ldiv</i>() function.

       <b>lldiv_t     </b>Structure type returned by  the  <i>ll‐
div</i>() function.

       <b>size_t         </b>As    described    in    <i>&lt;std‐
def.h&gt;</i>.

       <b>wchar_t        </b>As    described    in    <i>&lt;std‐
def.h&gt;</i>.

       In  addition, the <i>&lt;stdlib.h&gt;</i> header shall de‐
fine the following
       symbolic   constants   and   macros   as   described    in
<i>&lt;sys/wait.h&gt;</i>:

       WEXITSTATUS
       WIFEXITED
       WIFSIGNALED
       WIFSTOPPED
       WNOHANG
       WSTOPSIG
       WTERMSIG
       WUNTRACED

       The  following shall be declared as functions and may also
be defined
       as macros. Function prototypes shall be provided.

           <b>void          _Exit(int);</b>
           <b>long          a64l(const char *);</b>
           <b>void          abort(void);</b>
           <b>int           abs(int);</b>
           <b>int           atexit(void (*)(void));</b>
           <b>double        atof(const char *);</b>
           <b>int           atoi(const char *);</b>
           <b>long          atol(const char *);</b>
           <b>long long     atoll(const char *);</b>
           <b>void         *bsearch(const void *, const  void  *,
size_t, size_t,</b>
                             <b>int  (*)(const void *, const void
*));</b>
           <b>void         *calloc(size_t, size_t);</b>
           <b>div_t         div(int, int);</b>
           <b>double        drand48(void);</b>
           <b>double        erand48(unsigned short [3]);</b>
           <b>void          exit(int);</b>
           <b>void          free(void *);</b>
           <b>char         *getenv(const char *);</b>
           <b>int           getsubopt(char  **,  char  *const  *,
char **);</b>
           <b>int           grantpt(int);</b>
           <b>char             *initstate(unsigned,    char    *,
size_t);</b>
           <b>long          jrand48(unsigned short [3]);</b>
           <b>char         *l64a(long);</b>
           <b>long          labs(long);</b>
           <b>void          lcong48(unsigned short [7]);</b>
           <b>ldiv_t        ldiv(long, long);</b>
           <b>long long     llabs(long long);</b>
           <b>lldiv_t       lldiv(long long, long long);</b>
           <b>long          lrand48(void);</b>
           <b>void         *malloc(size_t);</b>
           <b>int           mblen(const char *, size_t);</b>
           <b>size_t         mbstowcs(wchar_t  *restrict,   const
char *restrict, size_t);</b>
           <b>int            mbtowc(wchar_t *restrict, const char
*restrict, size_t);</b>
           <b>char         *mkdtemp(char *);</b>
           <b>int           mkstemp(char *);</b>
           <b>long          mrand48(void);</b>
           <b>long          nrand48(unsigned short [3]);</b>
           <b>int             posix_memalign(void   **,   size_t,
size_t);</b>
           <b>int           posix_openpt(int);</b>
           <b>char         *ptsname(int);</b>
           <b>int           putenv(char *);</b>
           <b>void           qsort(void  *,  size_t,  size_t, int
(*)(const void *,</b>
                             <b>const void *));</b>
           <b>int           rand(void);</b>
           <b>int           rand_r(unsigned *);</b>
           <b>long          random(void);</b>
           <b>void         *realloc(void *, size_t);</b>
           <b>char         *realpath(const char  *restrict,  char
*restrict);</b>
           <b>unsigned short *seed48(unsigned short [3]);</b>
           <b>int            setenv(const  char  *, const char *,
int);</b>
           <b>void          setkey(const char *);</b>
           <b>char         *setstate(char *);</b>
           <b>void          srand(unsigned);</b>
           <b>void          srand48(long);</b>
           <b>void          srandom(unsigned);</b>
           <b>double         strtod(const  char  *restrict,  char
**restrict);</b>
           <b>float          strtof(const  char  *restrict,  char
**restrict);</b>
           <b>long           strtol(const  char  *restrict,  char
**restrict, int);</b>
           <b>long  double    strtold(const  char *restrict, char
**restrict);</b>
           <b>long long     strtoll(const  char  *restrict,  char
**restrict, int);</b>
           <b>unsigned  long  strtoul(const  char *restrict, char
**restrict, int);</b>
           <b>unsigned long long</b>
                         <b>strtoull(const char  *restrict,  char
**restrict, int);</b>
           <b>int           system(const char *);</b>
           <b>int           unlockpt(int);</b>
           <b>int           unsetenv(const char *);</b>
           <b>size_t           wcstombs(char   *restrict,   const
wchar_t *restrict, size_t);</b>
           <b>int           wctomb(char *, wchar_t);</b>

       Inclusion of the <i>&lt;stdlib.h&gt;</i> header  may  also
make visible all symbols
       from   <i>&lt;stddef.h&gt;</i>,   <i>&lt;limits.h&gt;</i>,
<i>&lt;math.h&gt;</i>, and <i>&lt;sys/wait.h&gt;</i>.

       <i>The  following  sections  are  informative.</i>  </pre>
<h2><a  id="APPLICATION_USAGE"  href="#APPLICATION_USAGE"></a>AP‐
PLICATION    USAGE     &nbsp;    &nbsp;    &nbsp;    &nbsp;    <a
href="#top_of_page"><span                             class="top‐
link">top</span></a></h2><pre>
       None.    </pre>   <h2><a   id="RATIONALE"    href="#RATIO‐
NALE"></a>RATIONALE     &nbsp;    &nbsp;    &nbsp;    &nbsp;   <a
href="#top_of_page"><span                             class="top‐
link">top</span></a></h2><pre>
       None.   </pre>  <h2><a  id="FUTURE_DIRECTIONS"  href="#FU‐
TURE_DIRECTIONS"></a>FUTURE DIRECTIONS  &nbsp; &nbsp; &nbsp; &nb‐
sp;        <a        href="#top_of_page"><span        class="top‐
link">top</span></a></h2><pre>
       None.    </pre>   <h2><a   id="SEE_ALSO"    href="#SEE_AL‐
SO"></a>SEE    ALSO     &nbsp;    &nbsp;    &nbsp;    &nbsp;   <a
href="#top_of_page"><span                             class="top‐
link">top</span></a></h2><pre>
       <a   href="../man0/limits.h.0p.html">limits.h(0p)</a>,  <a
href="../man0/math.h.0p.html">math.h(0p)</a>,                  <a
href="../man0/stddef.h.0p.html">stddef.h(0p)</a>,              <a
href="../man0/sys_types.h.0p.html">sys_types.h(0p)</a>,
       <a href="../man0/sys_wait.h.0p.html">sys_wait.h(0p)</a>

       The System Interfaces volume of  POSIX.1‐2008,  <i>Section
2.2</i>, <i>The</i>
       <i>Compilation   Environment</i>,   <a  href="../man3/_Ex‐
it.3p.html">_Exit(3p)</a>,                                     <a
href="../man3/a64l.3p.html">a64l(3p)</a>,                      <a
href="../man3/abort.3p.html">abort(3p)</a>,                    <a
href="../man3/abs.3p.html">abs(3p)</a>,
       <a     href="../man3/atexit.3p.html">atexit(3p)</a>,    <a
href="../man3/atof.3p.html">atof(3p)</a>,                      <a
href="../man3/atoi.3p.html">atoi(3p)</a>,                      <a
href="../man3/atol.3p.html">atol(3p)</a>,                      <a
href="../man3/bsearch.3p.html">bsearch(3p)</a>,                <a
href="../man3/calloc.3p.html">calloc(3p)</a>,
       <a       href="../man3/div.3p.html">div(3p)</a>,        <a
href="../man3/drand48.3p.html">drand48(3p)</a>,                <a
href="../man3/exit.3p.html">exit(3p)</a>,                      <a
href="../man3/free.3p.html">free(3p)</a>,                      <a
href="../man3/getenv.3p.html">getenv(3p)</a>,                  <a
href="../man3/getsubopt.3p.html">getsubopt(3p)</a>,
       <a    href="../man3/grantpt.3p.html">grantpt(3p)</a>,   <a
href="../man3/initstate.3p.html">initstate(3p)</a>,            <a
href="../man3/labs.3p.html">labs(3p)</a>,                      <a
href="../man3/ldiv.3p.html">ldiv(3p)</a>,  <a  href="../man3/mal‐
loc.3p.html">malloc(3p)</a>,
       <a      href="../man3/mblen.3p.html">mblen(3p)</a>,     <a
href="../man3/mbstowcs.3p.html">mbstowcs(3p)</a>,              <a
href="../man3/mbtowc.3p.html">mbtowc(3p)</a>,                  <a
href="../man3/mkdtemp.3p.html">mkdtemp(3p)</a>,                <a
href="../man3/posix_memalign.3p.html">posix_memalign(3p)</a>,
       <a
href="../man3/posix_openpt.3p.html">posix_openpt(3p)</a>,      <a
href="../man3/ptsname.3p.html">ptsname(3p)</a>,                <a
href="../man3/putenv.3p.html">putenv(3p)</a>,                  <a
href="../man3/qsort.3p.html">qsort(3p)</a>,                    <a
href="../man3/rand.3p.html">rand(3p)</a>,
       <a   href="../man3/realloc.3p.html">realloc(3p)</a>,    <a
href="../man3/realpath.3p.html">realpath(3p)</a>,              <a
href="../man3/setenv.3p.html">setenv(3p)</a>,                  <a
href="../man3/setkey.3p.html">setkey(3p)</a>,                  <a
href="../man3/strtod.3p.html">strtod(3p)</a>,
       <a    href="../man3/strtol.3p.html">strtol(3p)</a>,     <a
href="../man3/strtoul.3p.html">strtoul(3p)</a>,                <a
href="../man3/system.3p.html">system(3p)</a>,                  <a
href="../man3/unlockpt.3p.html">unlockpt(3p)</a>,              <a
href="../man3/unsetenv.3p.html">unsetenv(3p)</a>,
       <a  href="../man3/wcstombs.3p.html">wcstombs(3p)</a>,   <a
href="../man3/wctomb.3p.html">wctomb(3p)</a>     </pre>    <h2><a
id="COPYRIGHT"  href="#COPYRIGHT"></a>COPYRIGHT   &nbsp;   &nbsp;
&nbsp;    &nbsp;    <a    href="#top_of_page"><span   class="top‐
link">top</span></a></h2><pre>
       Portions of this text  are  reprinted  and  reproduced  in
electronic form
       from  IEEE Std 1003.1, 2013 Edition, Standard for Informa‐
tion
       Technology ‐‐ Portable Operating System Interface (POSIX),
The Open
       Group  Base  Specifications Issue 7, Copyright (C) 2013 by
the
       Institute of Electrical and Electronics Engineers, Inc and
The Open
       Group.  (This is POSIX.1‐2008 with the 2013 Technical Cor‐
rigendum 1
       applied.) In the event of  any  discrepancy  between  this
version and
       the  original IEEE and The Open Group Standard, the origi‐
nal IEEE and
       The Open Group Standard is the referee document. The orig‐
inal
       Standard     can     be     obtained    online    at    <a
href="http://www.unix.org/online.html">http://www.unix.org/on‐
line.html</a> .

       Any typographical or formatting errors that appear in this
page are
       most likely to have been introduced during the  conversion
of the
       source  files  to  man page format. To report such errors,
see
       <a      href="https://www.kernel.org/doc/man‐pages/report‐
ing_bugs.html">https://www.kernel.org/doc/man‐pages/report‐
ing_bugs.html</a> .

<span class="footline">IEEE/The Open  Group                  2013
stdlib.h(0P)</span> </pre>

<hr class="end‐man‐text" />

<hr class="start‐footer" />

<div class="footer">

<table class="colophon‐table">
    <tr>
    <td class="pub‐info">
        <p>
            HTML rendering created 2019‐08‐02
            by  <a  href="http://man7.org/mtk/index.html">Michael
Kerrisk</a>,
            author of
            <a  href="http://man7.org/tlpi/"><em>The  Linux  Pro‐
gramming Interface</em></a>,
            maintainer of the
            <a href="https://www.kernel.org/doc/man‐pages/">Linux
<em>man‐pages</em> project</a>.
        </p>
        <p>
            For details of in‐depth
            <strong>Linux/UNIX system programming training  cour‐
ses</strong>
            that  I  teach,  look <a href="http://man7.org/train‐
ing/">here</a>.
        </p>
        <p>
            Hosting   by    <a    href="http://www.jambit.com/in‐
dex_en.html">jambit GmbH</a>.
        </p>
        <p>
            <a href="http://validator.w3.org/check?uri=referer">
            <img src="http://www.w3.org/Icons/valid‐xhtml11"
                alt="Valid XHTML 1.1" height="31" width="88" />
            </a>
        </p>
    </td>
    <td class="colophon‐divider">
    </td>
    <td class="tlpi‐cover">
        <a                      href="http://man7.org/tlpi/"><img
src="http://man7.org/tlpi/cover/TLPI‐front‐cover‐vsmall.png"
alt="Cover of TLPI" /></a>
    </td>
    </tr> </table>

</div>

<hr class="end‐footer" />

</body> </html>