C Programming/stdlib.h

stdlib.h is the header of the general purpose standard library of C programming language which includes functions involving memory allocation, process control, conversions and others. It is compatible with C++ and is known as  in C++. The name "stdlib" stands for "standard library".

Member functions
Members of the  can be classified into the following categories: conversion, memory, process control, sort and search, mathematics.

NULL
The  and   header files define the macro , which yields a null pointer constant, and represents a pointer value that is guaranteed not to point to a valid address in memory.

Variants
NULL may be defined as a constant expression equal to int zero, long int zero, or zero cast to a void * pointer:

Although the null pointer constant is always represented in C by the symbolic constant 0 or by 0 cast to a void pointer, the actual bit representation of such a pointer is system-specific and may contain one-bits.

size_t
The size_t definition shall be provided to a referencing piece of code by including this header file. In fact most implementations don't have it defined literally in this file but instead include the file stddef.h as, for example, the standard library of the GNU C compiler does. The direct inclusion of stddef.h for application code is totally valid and thus can replace stdlib.h in cases where no other members from this file are needed or desired. This whole header file design conforms with e.g. the C99 ISO/ANSI standard definition.

div_t, ldiv_t
Two less widely used datatypes,  and , are also defined. They are the return types of the div and ldiv functions. The standard defines them as:

itoa
/itoa/ is a common function that is included in many implementations of stdlib.h, but the standard does not define the function. Although the same result can be achieved with sprintf, which is defined in the standard, calling  directly involves considerably less overhead than calling it (or an equivalent) via.