Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C standard library
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Application programming interface (API) == === {{Anchor|headers}}Header files === The [[application programming interface]] (API) of the C standard library is declared in a number of [[header file]]s. Each header file contains one or more function declarations, data type definitions, and macros. After a long period of stability, three new header files (<code>iso646.h</code>, <code>wchar.h</code>, and <code>wctype.h</code>) were added with ''Normative Addendum 1'' (NA1), an addition to the C Standard ratified in 1995. Six more header files (<code>complex.h</code>, <code>fenv.h</code>, <code>inttypes.h</code>, <code>stdbool.h</code>, <code>stdint.h</code>, and <code>tgmath.h</code>) were added with [[C99]], a revision to the C Standard published in 1999, five more files (<code>stdalign.h</code>, <code>stdatomic.h</code>, <code>stdnoreturn.h</code>, <code>threads.h</code>, and <code>uchar.h</code>) with [[C11 (C standard revision)|C11]] in 2011 and one more file (<code>stdbit.h</code>) with [[C23 (C standard revision)|C23]] in 2023. In total, there are now 30 header files: {| class="wikitable sortable" |- ! Name !! From !! Description |- | <code>[[assert.h|<assert.h>]]</code> || || Declares the [[assertion (computing)|assert]] macro, used to assist with detecting logical errors and other types of bugs while [[debugging]] a program. |- | <code>[[complex.h|<complex.h>]]</code> || C99 || Defines a [[C mathematical functions#complex.h|set of functions]] for manipulating [[complex number]]s. |- | <code>[[ctype.h|<ctype.h>]]</code> || || Defines [[C character classification|set of functions]] used to classify characters by their types or to convert between upper and lower case in a way that is independent of the used [[character set]] (typically [[ASCII]] or one of its extensions, although implementations utilizing [[EBCDIC]] are also known). |- | <code>[[errno.h|<errno.h>]]</code> || || For testing error codes reported by library functions. |- | <code>[[fenv.h|<fenv.h>]]</code> || C99 || Defines a [[C mathematical functions#fenv.h|set of functions]] for controlling [[floating-point]] environment. |- | <code>[[float.h|<float.h>]]</code> || || Defines [[C data types#float.h|macro constants]] specifying the implementation-specific properties of the [[floating-point]] library. |- | <code>[[inttypes.h|<inttypes.h>]]</code> || C99 || Defines [[C data types#inttypes.h|exact-width integer types]]. |- | <code>[[iso646.h|<iso646.h>]]</code> || NA1 || Defines [[C alternative tokens|several macros]] that implement alternative ways to express several standard tokens. For programming in [[ISO 646]] variant character sets. |- | <code>[[limits.h|<limits.h>]]</code> || || Defines [[C data types#limits.h|macro constants]] specifying the implementation-specific properties of the integer types. |- | <code><locale.h></code> || || Defines [[C localization functions|localization functions]]. |- | <code>[[math.h|<math.h>]]</code> || || Defines [[C mathematical functions|common mathematical functions]]. |- | <code>[[setjmp.h|<setjmp.h>]]</code> || || Declares the macros <code>setjmp</code> and <code>longjmp</code>, which are used for non-local exits. |- | <code>[[signal.h|<signal.h>]]</code> || || Defines [[C signal handling|signal-handling functions]]. |- | <code><stdalign.h></code> || C11 || For querying and specifying the [[Data structure alignment|alignment]] of objects. |- | <code>[[stdarg.h|<stdarg.h>]]</code> || || For accessing a varying number of arguments passed to functions. |- | <code><stdatomic.h></code> || C11 || For [[Linearizability|atomic operations]] on data shared between threads. |- | <code><stdbit.h></code> || C23 || For byte ordening and bit representation. |- | <code>[[stdbool.h|<stdbool.h>]]</code> || C99 || Defines [[C data types#stdbool.h|a Boolean data type]]. |- | <code>[[stddef.h|<stddef.h>]]</code> || || Defines [[C data types#stddef.h|several useful types and macros]]. |- | <code>[[stdint.h|<stdint.h>]]</code> || C99 || Defines [[C data types#stdint.h|exact-width integer types]]. |- | <code>[[stdio.h|<stdio.h>]]</code> || || Defines [[C file input/output|core input and output functions]] |- | <code><stdlib.h></code> || || Defines [[C string handling#stdlib.h|numeric conversion functions]], [[C mathematical functions#stdlib.h|pseudo-random numbers generation functions]], [[C dynamic memory allocation|memory allocation]], [[C process control|process control functions]] |- | <code><stdnoreturn.h></code> || C11 || For specifying non-returning functions |- | <code>[[string.h|<string.h>]]</code> || || Defines [[C string handling|string-handling functions]] |- | <code>[[tgmath.h|<tgmath.h>]]</code> || C99 || Defines [[C mathematical functions#tgmath.h|type-generic mathematical functions]]. |- | <code><threads.h></code> || C11 || Defines functions for managing multiple [[Thread (computer science)|threads]], [[Mutual exclusion|mutexes]] and [[Monitor (synchronization)|condition variables]] |- | <code>[[time.h|<time.h>]]</code> || || Defines [[C date and time functions|date- and time-handling functions]] |- | <code><uchar.h></code> || C11 || Types and functions for manipulating [[Unicode]] characters |- | <code>[[wchar.h|<wchar.h>]]</code> || NA1 || Defines [[C string handling|wide-string-handling functions]] |- | <code>[[wctype.h|<wctype.h>]]</code> || NA1 || Defines [[C character classification|set of functions]] used to classify wide characters by their types or to convert between upper and lower case |} Three of the header files (<code>complex.h</code>, <code>stdatomic.h</code>, and <code>threads.h</code>) are conditional features that implementations are not required to support. The [[POSIX]] standard added several nonstandard C headers for Unix-specific functionality. Many have found their way to other architectures. Examples include <code>[[fcntl.h]]</code> and <code>[[unistd.h]]</code>. A number of other groups are using other nonstandard headers β the [[GNU C Library]] has <code>alloca.h</code>, and [[OpenVMS]] has the <code>va_count()</code> function. === Documentation === On Unix-like systems, the authoritative documentation of the API is provided in the form of [[man page]]s. On most systems, man pages on standard library functions are in section 3; section 7 may contain some more generic pages on underlying concepts (e.g. <code>man 7 math_error</code> in [[Linux]]).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)