Stdlib.h

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 cstdlib in C++. The name "stdlib" stands for standard library.

Member functions

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

Member constants

The stdlib.h and stddef.h header files define the macro NULL, which yields a null pointer constant, and represents a pointer value that is guaranteed not to point to a valid address in memory. NULL may be defined as a constant expression equal to int zero, long int zero, or zero cast to a void * pointer:

#define NULL 0 #define NULL 0L #define NULL ((void *) 0)

Note: 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 might not be all-bits-zero.

Member data types

The stdlib.h library is required to define a datatype called size_t [As per the C99 standard ISO/IEC 9899, Section "7.20 General utilities " (point number 2) and Appendix "B.19 General utilities ". The definition can also provided by stddef.h if one wants to avoid including the whole of stdlib.] which is used to represent the size of an object. Library functions that take sizes expect them to be of type size_t, and the sizeof operator evaluates to size_t.

The actual type of size_t is platform-dependent; a common mistake is to assume size_t is the same as unsigned int, which can lead to programming errors [http://www.gamedev.net/reference/programming/features/20issues64bit/] ,particularly as 64-bit architectures become more prevalent.

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

typedef struct { int quot, rem;} div_t;

typedef struct { long int quot, rem;} ldiv_t;

Nonstandard functions

itoa is a common function that is included in many implementations of stdlib.h, but the standard does not define the function. It may have been included because of its appearance in "The C Programming Language". The same effect can be achieved with sprintf, which is defined in the standard.

ee also

*stdio.h
*C standard library

References

* [http://www.cplusplus.com/ref/cstdlib/ stdlib.h summary on cplusplus.com] , accessed in February 2006.
* [http://www.embedded.com/columns/programmingpointers/200900195?pgno=1 Why size_t matters]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Stdlib.h — заголовок (заголовочный файл) стандартной библиотеки общего назначения языка Си, который содержит в себе функции, занимающиеся выделением памяти, контроль процесса выполнения программы, преобразования типов и другие. Заголовок вполне совместим с… …   Википедия

  • Stdlib.h — Saltar a navegación, búsqueda stdlib.h (std lib: standar library o biblioteca estándar) es el archivo de cabecera de la biblioteca estándar de propósito general del lenguaje de programación C. Contiene los prototipos de funciones de C para… …   Wikipedia Español

  • stdlib.h — (std lib: standard library o biblioteca estándar) es el archivo de cabecera de la biblioteca estándar de propósito general del lenguaje de programación C. Contiene los prototipos de funciones de C para gestión de memoria dinámica, control de… …   Wikipedia Español

  • stdlib.h — Стандартная библиотека языка программирования С assert.h complex.h ctype.h errno.h fenv.h float.h inttypes.h iso646.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stdbool.h stddef.h stdint.h …   Википедия

  • System (stdlib) — Saltar a navegación, búsqueda La función system() está incluída en la biblioteca cuya cabecera es <stdlib.h>. System permite ejecutar a su vez otras funciones como: cls , dir o pause . Por ejemplo, al escribir system ( pause ) se está… …   Wikipedia Español

  • system (stdlib) — system() es una función del lenguaje de programación C incluida en su biblioteca estándar, dentro de la cabecera <stdlib.h>. Sirve para ejecutar subprocesos o comandos del sistema operativo. «system» permite ejecutar a su vez otras… …   Wikipedia Español

  • Dao (programming language) — Infobox programming language name = Dao paradigm = Multi paradigm year = 2006 designer = Limin Fu latest release version = dao 1.0 preview latest release date = 2008 04 25 typing = statically typed or dynamically typed influenced by = C++, Lua,… …   Wikipedia

  • Strtod — is a C language function that converts an ASCII string to a double precision value. It is utilized via the following sequence:double strtod(const char *restrict, char **restrict); [OpenGroup Technical Standards Documentation] Strtod is included… …   Wikipedia

  • strtod — (сокр. от string to double, «строку в число двойной точности»)  функция языка Си, конвертирующая символ строки в число с плавающей запятой двойной точности. Определение функции имеет вид: double strtod ( const char * str, char ** endptr… …   Википедия

  • Memory leak — A memory leak, in computer science (or leakage, in this context), occurs when a computer program consumes memory but is unable to release it back to the operating system. In object oriented programming, a memory leak happens when an object is… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”