(→Standard Headers) |
(fixed) |
||
| Line 1: | Line 1: | ||
| − | {{c title|Standard Library}} | + | {{c title|Standard Library}}{{C Standard Library}} |
The '''C standard library''' is a [[standard library|standardized collection]] of headers and library functions for the [[C|C programming language]]. The library provides a set of commonly used macros, type definitions, and functions to perform common tasks such as [[string manipulation|string handling]], [[IO processing|input/output processing]], [[memory allocation]], [[math computations]], [[thread management]], and various other common services. | The '''C standard library''' is a [[standard library|standardized collection]] of headers and library functions for the [[C|C programming language]]. The library provides a set of commonly used macros, type definitions, and functions to perform common tasks such as [[string manipulation|string handling]], [[IO processing|input/output processing]], [[memory allocation]], [[math computations]], [[thread management]], and various other common services. | ||
| − | |||
== Standard Headers == | == Standard Headers == | ||
| − | |||
Related functions, necessary types to use those functions and related macros are grouped into headers. Collectively, they are known as the '''standard headers'''. | Related functions, necessary types to use those functions and related macros are grouped into headers. Collectively, they are known as the '''standard headers'''. | ||
| Line 19: | Line 17: | ||
* {{c header|errno.h}} | * {{c header|errno.h}} | ||
* {{c header|fenv.h}} | * {{c header|fenv.h}} | ||
| + | |||
* {{c header|float.h}} | * {{c header|float.h}} | ||
* {{c header|inttypes.h}} | * {{c header|inttypes.h}} | ||
| Line 24: | Line 23: | ||
* {{c header|limits.h}} | * {{c header|limits.h}} | ||
* {{c header|locale.h}} | * {{c header|locale.h}} | ||
| + | |||
* {{c header|math.h}} | * {{c header|math.h}} | ||
* {{c header|setjmp.h}} | * {{c header|setjmp.h}} | ||
| Line 29: | Line 29: | ||
* {{c header|stdalign.h}} | * {{c header|stdalign.h}} | ||
* {{c header|stdarg.h}} | * {{c header|stdarg.h}} | ||
| + | |||
* {{c header|stdatomic.h}} | * {{c header|stdatomic.h}} | ||
* {{c header|stdbool.h}} | * {{c header|stdbool.h}} | ||
| Line 34: | Line 35: | ||
* {{c header|stdint.h}} | * {{c header|stdint.h}} | ||
* {{c header|stdio.h}} | * {{c header|stdio.h}} | ||
| + | |||
* {{c header|stdlib.h}} | * {{c header|stdlib.h}} | ||
* {{c header|stdnoreturn.h}} | * {{c header|stdnoreturn.h}} | ||
| Line 39: | Line 41: | ||
* {{c header|tgmath.h}} | * {{c header|tgmath.h}} | ||
* {{c header|threads.h}} | * {{c header|threads.h}} | ||
| + | |||
* {{c header|time.h}} | * {{c header|time.h}} | ||
* {{c header|uchar.h}} | * {{c header|uchar.h}} | ||
| Line 46: | Line 49: | ||
== Optional headers == | == Optional headers == | ||
| − | |||
3 of the 29 standard headers are optional: | 3 of the 29 standard headers are optional: | ||
| Line 55: | Line 57: | ||
While implementations are encouraged to support those headers, they are not required to. | While implementations are encouraged to support those headers, they are not required to. | ||
| − | == Detailed description == | + | == Detailed description == |
| − | |||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
| Line 62: | Line 63: | ||
! Header Name !! Since !! Description | ! Header Name !! Since !! Description | ||
|- | |- | ||
| − | |{{C|assert.h|<assert.h>}} || C89 || Provides a set of assertion macros used in assisting with debugging and detecting logic errors. | + | |{{C|assert.h|<assert.h>}} || {{C|C89}} || Provides a set of assertion macros used in assisting with debugging and detecting logic errors. |
|- | |- | ||
| − | |{{C|complex.h|<complex.h>}} || C99 || Provides a set of functions used to manipulate complex numbers. | + | |{{C|complex.h|<complex.h>}} || {{C|C99}}<small>op</small> || Provides a set of functions used to manipulate complex numbers. |
|- | |- | ||
| − | |{{C|ctype.h|<ctype.h>}} || C89 || Provides a set of functions used for classifying characters. | + | |{{C|ctype.h|<ctype.h>}} || {{C|C89}} || Provides a set of functions used for classifying characters. |
|- | |- | ||
| − | |{{C|errno.h|<errno.h>}} || C89 || Provides a set of predefined values for {{C|errno}}. | + | |{{C|errno.h|<errno.h>}} || {{C|C89}} || Provides a set of predefined values for {{C|errno}}. |
|- | |- | ||
| − | |{{C|fenv.h|<fenv.h>}} || C99 || Provides a set of functions for controlling the floating-point environment. | + | |{{C|fenv.h|<fenv.h>}} || {{C|C99}} || Provides a set of functions for controlling the floating-point environment. |
|- | |- | ||
| − | |{{C|float.h|<float.h>}} || C89 || Provides a set of macros defining the implementation of the floating-point environment. | + | |{{C|float.h|<float.h>}} || {{C|C89}} || Provides a set of macros defining the implementation of the floating-point environment. |
|- | |- | ||
| − | |{{C|inttypes.h|<inttypes.h>}} || C99 || Provides a set of exact width integer types. | + | |{{C|inttypes.h|<inttypes.h>}} || {{C|C99}} || Provides a set of exact width integer types. |
|- | |- | ||
| − | |{{C|iso646.h|<iso646.h>}} || NA1 || Provides a set of macros that implement an alternative way of expressing various C operators | + | |{{C|iso646.h|<iso646.h>}} || {{C|NA1}} || Provides a set of macros that implement an alternative way of expressing various C operators |
|- | |- | ||
| − | |{{C|limits.h|<limits.h>}} || C89 || Provides a set of macros specifying the implementation-specific limits of the integer types. | + | |{{C|limits.h|<limits.h>}} || {{C|C89}} || Provides a set of macros specifying the implementation-specific limits of the integer types. |
|- | |- | ||
| − | |{{C|locale.h|<locale.h>}} || C89 || Provides a set of functions localization functions | + | |{{C|locale.h|<locale.h>}} || {{C|C89}} || Provides a set of functions localization functions |
|- | |- | ||
| − | |{{C|math.h|<math.h>}} || C89 || Provides a set of common mathematical functions. | + | |{{C|math.h|<math.h>}} || {{C|C89}} || Provides a set of common mathematical functions. |
|- | |- | ||
| − | |{{C|setjmp.h|<setjmp.h>}} || C89 || Provides macros to perform non-local jump operators. | + | |{{C|setjmp.h|<setjmp.h>}} || {{C|C89}} || Provides macros to perform non-local jump operators. |
|- | |- | ||
| − | |{{C|signal.h|<signal.h>}} || C89 || Provides a set of signal handling functions. | + | |{{C|signal.h|<signal.h>}} || {{C|C89}} || Provides a set of signal handling functions. |
|- | |- | ||
| − | |{{C|stdalign.h|<stdalign.h>}} || C11 || Provides a set of macros for working with object alignments. | + | |{{C|stdalign.h|<stdalign.h>}} || {{C|C11}} || Provides a set of macros for working with object alignments. |
|- | |- | ||
| − | |{{C|stdarg.h|<stdarg.h>}} || C89 || Provides a set of macros for working with variadic functions | + | |{{C|stdarg.h|<stdarg.h>}} || {{C|C89}} || Provides a set of macros for working with variadic functions |
|- | |- | ||
| − | |{{C|stdatomic.h|<stdatomic.h>}} || C11 || Provides a set of functions for performing atomic operations on data. | + | |{{C|stdatomic.h|<stdatomic.h>}} || {{C|C11}}<small>op</small> || Provides a set of functions for performing atomic operations on data. |
|- | |- | ||
| − | |{{C|stdbool.h|<stdbool.h>}} || C99 || Provides boolean macros. | + | |{{C|stdbool.h|<stdbool.h>}} || {{C|C99}} || Provides boolean macros. |
|- | |- | ||
| − | |{{C|stddef.h|<stddef.h>}} || C89 || Provides a set of commonly used type definitions within the standard library. | + | |{{C|stddef.h|<stddef.h>}} || {{C|C89}} || Provides a set of commonly used type definitions within the standard library. |
|- | |- | ||
| − | |{{C|stdint.h|<stdint.h>}} || C99 || Provides a set of exact width integer types. | + | |{{C|stdint.h|<stdint.h>}} || {{C|C99}} || Provides a set of exact width integer types. |
|- | |- | ||
| − | |{{C|stdio.h|<stdio.h>}} || C89 || Provides a set of standard input/output processing functions. | + | |{{C|stdio.h|<stdio.h>}} || {{C|C89}} || Provides a set of standard input/output processing functions. |
|- | |- | ||
| − | |{{C|stdlib.h|<stdlib.h>}} || C89 || Provides core library functions such as memory management and random number generation. | + | |{{C|stdlib.h|<stdlib.h>}} || {{C|C89}} || Provides core library functions such as memory management and random number generation. |
|- | |- | ||
| − | |{{C|stdnoreturn.h|<stdnoreturn.h>}} || C11 || Provides a macro for specifying non-returning functions. | + | |{{C|stdnoreturn.h|<stdnoreturn.h>}} || {{C|C11}} || Provides a macro for specifying non-returning functions. |
|- | |- | ||
| − | |{{C|string.h|<string.h>}} || C89 || Provides a set of string handling|string handling functions. | + | |{{C|string.h|<string.h>}} || {{C|C89}} || Provides a set of string handling|string handling functions. |
|- | |- | ||
| − | |{{C|tgmath.h|<tgmath.h>}} || C99 || Provides a set of type-generic math functions. | + | |{{C|tgmath.h|<tgmath.h>}} || {{C|C99}} || Provides a set of type-generic math functions. |
|- | |- | ||
| − | |{{C|threads.h|<threads.h>}} || C11 || Provides a set of thread management functions. | + | |{{C|threads.h|<threads.h>}} || {{C|C11}}<small>op</small> || Provides a set of thread management functions. |
|- | |- | ||
| − | |{{C|time.h|<time.h>}} || C89 || Provides a set of date and time handling functions. | + | |{{C|time.h|<time.h>}} || {{C|C89}} || Provides a set of date and time handling functions. |
|- | |- | ||
| − | |{{C|uchar.h|<uchar.h>}} || C11 || Provides a set of Unicode character manipulation functions. | + | |{{C|uchar.h|<uchar.h>}} || {{C|C11}} || Provides a set of Unicode character manipulation functions. |
|- | |- | ||
| − | |{{C|wchar.h|<wchar.h>}} || NA1 || Provides a set of wide string handling|string handling functions. | + | |{{C|wchar.h|<wchar.h>}} || {{C|NA1}} || Provides a set of wide string handling|string handling functions. |
|- | |- | ||
| − | |{{C|wctype.h|<wctype.h>}} || NA1 || Provides a set of functions used for classifying wide characters. | + | |{{C|wctype.h|<wctype.h>}} || {{C|NA1}} || Provides a set of functions used for classifying wide characters. |
|} | |} | ||
== Embedded C == | == Embedded C == | ||
{{main|c/embedded|l1=Embedded C}} | {{main|c/embedded|l1=Embedded C}} | ||
| − | Embedded C introduced two optional headers {{C|stdfix.h|<stdfix.h>}} and {{C|iohw.h|<iohw.h>}}. The headers not formally part of the standard library. | + | Embedded C introduced two optional headers {{C|stdfix.h|<stdfix.h>}} and {{C|iohw.h|<iohw.h>}}. |
| + | :The headers not formally part of the standard library. | ||
== See also == | == See also == | ||
Latest revision as of 23:50, 30 October 2025
The C standard library is a standardized collection of headers and library functions for the C programming language. The library provides a set of commonly used macros, type definitions, and functions to perform common tasks such as string handling, input/output processing, memory allocation, math computations, thread management, and various other common services.
Standard Headers[edit]
Related functions, necessary types to use those functions and related macros are grouped into headers. Collectively, they are known as the standard headers.
Standard C provides 29 standard headers. The headers may be included in any order. The headers may also be included more than once - the effect of that is as if it was only included once. All standard C functions have external linkage.
Optional headers[edit]
3 of the 29 standard headers are optional:
While implementations are encouraged to support those headers, they are not required to.
Detailed description[edit]
| Header Name | Since | Description |
|---|---|---|
| <assert.h> | C89 | Provides a set of assertion macros used in assisting with debugging and detecting logic errors. |
| <complex.h> | C99op | Provides a set of functions used to manipulate complex numbers. |
| <ctype.h> | C89 | Provides a set of functions used for classifying characters. |
| <errno.h> | C89 | Provides a set of predefined values for errno. |
| <fenv.h> | C99 | Provides a set of functions for controlling the floating-point environment. |
| <float.h> | C89 | Provides a set of macros defining the implementation of the floating-point environment. |
| <inttypes.h> | C99 | Provides a set of exact width integer types. |
| <iso646.h> | NA1 | Provides a set of macros that implement an alternative way of expressing various C operators |
| <limits.h> | C89 | Provides a set of macros specifying the implementation-specific limits of the integer types. |
| <locale.h> | C89 | Provides a set of functions localization functions |
| <math.h> | C89 | Provides a set of common mathematical functions. |
| <setjmp.h> | C89 | Provides macros to perform non-local jump operators. |
| <signal.h> | C89 | Provides a set of signal handling functions. |
| <stdalign.h> | C11 | Provides a set of macros for working with object alignments. |
| <stdarg.h> | C89 | Provides a set of macros for working with variadic functions |
| <stdatomic.h> | C11op | Provides a set of functions for performing atomic operations on data. |
| <stdbool.h> | C99 | Provides boolean macros. |
| <stddef.h> | C89 | Provides a set of commonly used type definitions within the standard library. |
| <stdint.h> | C99 | Provides a set of exact width integer types. |
| <stdio.h> | C89 | Provides a set of standard input/output processing functions. |
| <stdlib.h> | C89 | Provides core library functions such as memory management and random number generation. |
| <stdnoreturn.h> | C11 | Provides a macro for specifying non-returning functions. |
| <string.h> | C89 | string handling functions. |
| <tgmath.h> | C99 | Provides a set of type-generic math functions. |
| <threads.h> | C11op | Provides a set of thread management functions. |
| <time.h> | C89 | Provides a set of date and time handling functions. |
| <uchar.h> | C11 | Provides a set of Unicode character manipulation functions. |
| <wchar.h> | NA1 | string handling functions. |
| <wctype.h> | NA1 | Provides a set of functions used for classifying wide characters. |
Embedded C[edit]
- Main article: Embedded C
Embedded C introduced two optional headers <stdfix.h> and <iohw.h>.
- The headers not formally part of the standard library.