Wednesday, August 31, 2016

C Library Header – wctype

The header <wctype.h> defines set of functions used to classify wide characters by their types or to convert between upper and lower case.

The < wctype.h> header shall define the following macro constant:
WEOF Wide End-of-File

The < wctype.h> header shall define the following function:
Character Classification:
iswalnum checks if a wide character is alphanumeric (C95)
iswalpha checks if a wide character is alphabetic (C95)
iswlower checks if a wide character is an lowercase character (C95)
iswupper checks if a wide character is an uppercase character (C95)
iswdigit checks if a wide character is a digit (C95)
iswxdigit checks if a character is a hexadecimal character (C95)
iswcntrl checks if a wide character is a control character (C95)
iswgraph checks if a wide character is a graphical character (C95)
iswspace checks if a wide character is a space character (C95)
iswblank checks if a wide character is a blank character (C99)
iswprint checks if a wide character is a printing character (C95)
iswpunct checks if a wide character is a punctuation character (C95)
iswctype classifies a wide character according to the specified LC_CTYPE category (C95)
wctype looks up a character classification category in the current C locale (C95)

Character Manipulation:
towlower converts a wide character to lowercase (C95)
towupper converts a wide character to uppercase (C95)
towctrans performs character mapping according to the specified LC_CTYPE mapping category (C95)
wctrans looks up a character mapping category in the current C locale (C95)

The < wctype.h> header shall define the following type:
wchar_t integer type that can hold any valid wide character
wint_t integer type that can hold any valid wide character and at least one more value (C95)
wctrans_t scalar type that holds locale-specific character mapping (C95)
wctype_t scalar type that holds locale-specific character classification (C95)



Related topics:
<tgmath.h>   |   <threads.h>   |   <time.h>   |   <uchar.h>   |   <wchar.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – wchar

The header <wchar.h> defines wide string handling functions.

The <wchar.h> header shall define the following macro constants:
WEOF a non-character value of type wint_t used to indicate errors (C95)
WCHAR_MIN the smallest valid value of wchar_t (C95)
WCHAR_MAX the largest valid value of wchar_t (C95)

The <wchar.h> header shall define the following functions:
Input/Output:
fgetwc Get wide character from stream
fgetws Get wide string from stream
fputwcWrite wide character to stream
fputws Write wide string to stream
fwide Stream orientation
fwprintf Write formatted data to stream
fwscanf Read formatted data from stream
getwc Get wide character from stream
getwchar Get wide character from stdin
putwc Write wide character to stream
putwchar Write wide character to stdout
swprintf Write formatted data to wide string
swscanf Read formatted data from string
ungetwc Unget wide character from stream
vfwprintf Write formatted data from variable argument list to stream
vfwscanf Read formatted data from stream into variable argument list (C11)
vswprintf Write formatted data from variable argument list to sized buffer (C11)
vswscanf Read formatted data from wide string into variable argument list (C11)
vwprintf Print formatted data from variable argument list to stdout
vwscanf Read formatted data into variable argument list (C11)
wprintf Print formatted data to stdout
wscanf Read formatted data from stdin

General Utilities:
wcstol(C95)
wcstoll(C99)
converts a wide string to an integer value
wcstoul(C95)
wcstoull(C99)
converts a wide string to an unsigned integer value
wcstof(C99)
wcstod(C95)
wcstold(C99)
converts a wide string to a floating point value
btowc Convert single byte character to wide character
mbrlen Get length of multibyte character
mbrtowc Convert multibyte sequence to wide character
mbsinit Check if initial conversion state
mbsrtowcs Convert multibyte string to wide-character string
wcrtomb Convert wide character to multibyte sequence
wctob Convert wide character to single byte
wcsrtombs Convert wide-character string to multibyte string

Strings:
wcscpy(C95)
wcscpy_s(C11)
copies one wide string to another
wcsncpy(C95)
wcsncpy_s(C11)
copies a certain amount of wide characters from one string to another
wcscat(C95)
wcscat_s(C11)
appends a copy of one wide string to another
wcsncat(C95)
wcsncat_s(C11)
appends a certain amount of wide characters from one wide string to another
wcsxfrmtransform a wide string so that wcscmp would produce the same result as wcscoll (C95)
wcslen(C95)
wcsnlen_s(C11)
returns the length of a wide string
wcscmp compares two wide strings (C95)
wcsncmp compares a certain amount of characters from two wide strings (C95)
wcscoll compares two wide strings in accordance to the current locale (C95)
wcschr finds the first occurrence of a wide character in a wide string (C95)
wcsrchr finds the last occurrence of a wide character in a wide string (C95)
wcsspn returns the length of the maximum initial segment that consists of only the wide characters found in another wide string (C95)
wcscspn returns the length of the maximum initial segment that consists of only the wide chars not found in another wide string (C95)
wcspbrk finds the first location of any wide character in one wide string, in another wide string (C95)
wcsstr finds the first occurrence of a wide string within another wide string (C95)
wcstok(C95)
wcstok_s(C11)
finds the next token in a wide string

Wide character array manipulation:
wmemcpy(C95)
wmemcpy_s(C11)
copies a certain amount of wide characters between two non-overlapping arrays
wmemmove(C95)
wmemmove_s(C11)
copies a certain amount of wide characters between two, possibly overlapping, arrays
wmemcmp compares a certain amount of wide characters from two arrays (C95)
wmemchr finds the first occurrence of a wide character in a wide character array (C95)
wmemset copies the given wide character to every position in a wide character array (C95)

Time:
wcsftime Format time as wide string



Related topics:
<tgmath.h>   |   <threads.h>   |   <time.h>   |   <uchar.h>   |   <wctype.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – uchar

The header <uchar.h> provides types and functions for manipulating Unicode characters.

The <uchar.h> header shall define the following macro constants:
__STDC_UTF_16__ indicates that UTF-16 encoding is used by mbrtoc16 and c16rtomb (C11)
__STDC_UTF_32__ indicates that UTF-32 encoding is used by mbrtoc32 and c32rtomb (C11)

The <uchar.h> header shall define the following functions:
mbrtoc16 generate the next 16-bit wide character from a narrow multibyte string (C11)
c16rtomb convert a 16-bit wide character to narrow multibyte string (C11)
mbrtoc32 generate the next 32-bit wide character from a narrow multibyte string (C11)
c32rtomb convert a 32-bit wide character to narrow multibyte string (C11)



Related topics:
<tgmath.h>   |   <threads.h>   |   <time.h>   |   <wchar.h>   |   <wctype.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – time

The <time.h> header provides several functions useful for reading and converting the current time and date.

The <time.h> header shall define the following macro constant:
CLOCKS_PER_SECnumber of processor clock ticks per second

The <time.h> header shall define the following function:
Time manipulation:
difftimecomputes the difference between times
timereturns the current calendar time of the system as time since epoch
clockreturns raw processor clock time since the program is started
timespec_get returns the calendar time based on a given time base (C11)

Conversion:
asctime
asctime_s(C11)
converts a tm object to a textual representation
ctime
ctime_s(C11)
converts a time_t object to a textual representation
strftimeconverts a tm object to custom textual representation (function)
gmtime
gmtime_s(C11)
converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC)
localtime
localtime_s(C11)
converts time since epoch to calendar time expressed as local time
mktimeconverts calendar time to time since epoch

The <time.h> header shall define the following type:
tmcalendar time type (struct)
time_tcalendar time since epoch type
clock_tprocessor time since era type
timespec time in seconds and nanoseconds (struct)(C11)



Related topics:
<tgmath.h>   |   <threads.h>   |   <uchar.h>   |   <wchar.h>   |   <wctype.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – threads

The <threads.h> header defines functions for managing multiple Threads as well as mutexes and condition variables.

The <threads.h> header shall define the following macro constants:
thrd_success
thrd_timedout
thrd_busy
thrd_nomem
thrd_error
indicates a thread error status (C11)
thread_localthread local type macro (C11)
TSS_DTOR_ITERATIONSmaximum number of times destructors are called (C11)

The <threads.h> header shall define the following functions:
thrd_createcreates a thread (C11)
thrd_equalchecks if two identifiers refer to the same thread (C11)
thrd_currentobtains the current thread identifier (C11)
thrd_sleepsuspends execution of the calling thread for the given period of time (C11)
thrd_yieldyields the current time slice (C11)
thrd_exitterminates the calling thread (C11)
thrd_detachdetaches a thread (C11)
thrd_joinblocks until a thread terminates (C11)
mtx_init creates a mutex (C11)
mtx_lock blocks until locks a mutex (C11)
mtx_timedlock blocks until locks a mutex or times out (C11)
mtx_trylock locks a mutex or returns without blocking if already locked (C11)
mtx_unlock unlocks a mutex (C11)
mtx_destroy destroys a mutex (C11)
cnd_init creates a condition variable (C11)
cnd_signal unblocks one thread blocked on a condition variable (C11)
cnd_broadcast unblocks all threads blocked on a condition variable (C11)
cnd_wait blocks on a condition variable (C11)
cnd_timedwait blocks on a condition variable, with a timeout (C11)
cnd_destroy destroys a condition variable (C11)
tss_create creates thread-specific storage pointer with a given destructor (C11)
tss_get reads from thread-specific storage (C11)
tss_set write to thread-specific storage (C11)
tss_delete releases the resources held by a given thread-specific pointer (C11)

The <threads.h> header shall define the following type:
thrd_t implementation-defined complete object type identifying a thread
thrd_start_t a typedef of the function pointer type int(*)(void*), used by thrd_create (C11)
mtx_t mutex identifier
mtx_plain
mtx_recursive
mtx_timed
defines the type of a mutex (enum)(C11)
cnd_t condition variable identifier
tss_t thread-specific storage pointer
tss_dtor_t function pointer type void(*)(void*), used for TSS destructor



Related topics:
<tgmath.h>   |   <time.h>   |   <uchar.h>   |   <wchar.h>   |   <wctype.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – tgmath

The <tgmath.h> header defines a type-generic macro for each mathematical function defined in <math.h> and <complex.h>.

The <tgmath.h> header shall define the following macros:

For all functions that have both real and complex counterparts, a type-generic macro XXX exists.
Type-generic macro Real function variantsComplex function variants
floatdoublelong doublefloatdoublelong double
fabs fabsf fabs fabsl cabsf cabs cabsl
exp expf exp expl cexpf cexp cexpl
log logf log logl clogf clog clogl
pow powf pow powl cpowf cpow cpowl
sqrt sqrtf sqrt sqrtl csqrtf csqrt csqrtl
sin sinf sin sinl csinf csin csinl
cos cosf cos cosl ccosf ccos ccosl
tan tanf tan tanl ctanf ctan ctanl
asin asinf asin asinl casinf casin casinl
acos acosf acos acosl cacosf cacos cacosl
atan atanf atan atanl catanf catan catanl
sinh sinhf sinh sinhl csinhf csinh csinhl
cosh coshf cosh coshl ccoshf ccosh ccoshl
tanh tanhf tanh tanhl ctanhf ctanh ctanhl
asinh asinhf asinh asinhl casinhf casinh casinhl
acosh acoshf acosh acoshl cacoshf cacosh cacoshl
atanh atanhf atanh atanhl catanhf catanh catanhl

For all functions that do not have complex counterparts, a type-generic macro XXX exists.
Type-generic macro Real function variants
float double long double
atan2 atan2f atan2 atan2l
cbrt cbrtf cbrt cbrtl
ceil ceilf ceil ceill
copysign copysignf copysign copysignl
erf erff erf erfl
erfc erfcf erfc erfcl
exp2 exp2f exp2 exp2l
expm1 expm1f expm1 expm1l
fdim fdimf fdim fdiml
floor floorf floor floorl
fma fmaf fma fmal
fmax fmaxf fmax fmaxl
fmin fminf fmin fminl
fmod fmodf fmod fmodl
frexp frexpf frexp frexpl
hypot hypotf hypot hypotl
ilogb ilogbf ilogb ilogbl
ldexp ldexpf ldexp ldexpl
lgamma lgammaf lgamma lgammal
llrint llrintf llrint llrintl
llround llroundf llround llroundl
log10 log10f log10 log10l
log1p log1pf log1p log1pl
log2 log2f log2 log2l
logb logbf logb logbl
lrint lrintf lrint lrintl
lround lroundf lround lroundl
nearbyint nearbyintf nearbyint nearbyintl
nextafter nextafterf nextafter nextafterl
nexttoward nexttowardf nexttoward nexttowardl
remainder remainderf remainder remainderl
remquo remquof remquo remquol
rint rintf rint rintl
round roundf round roundl
scalbln scalblnf scalbln scalblnl
scalbn scalbnf scalbn scalbnl
tgamma tgammaf tgamma tgammal
trunc truncf trunc truncl

For all complex number functions that do not have real counterparts, a type-generic macro cXXX exists.
Type-generic macro Complex function variants
float double long double
carg cargf carg cargl
conj conjf conj conjl
creal crealf creal creall
cimag cimagf cimag cimagl
cproj cprojf cproj cprojl



Related topics:
<threads.h>   |   <time.h>   |   <uchar.h>   |   <wchar.h>   |   <wctype.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – string

The <string.h> header provides many functions useful for manipulating strings (character arrays).

The <string.h> header shall define the following macros:
NULLNull pointer

The <string.h> header shall define the following function:
String manipulation:
strcpy
strcpy_s(C11)
copies one string to another
strncpy
strncpy_s(C11)
copies a certain amount of characters from one string to another
strcat
strcat_s(C11)
concatenates two strings
strncat
strncat_s(C11)
concatenates a certain amount of characters of two strings
strxfrmtransform a string so that strcmp would produce the same result as strcoll

String examination:
strlen
strnlen_s(C11)
returns the length of a given string
strcmpcompares two strings
strncmpcompares a certain amount of characters of two strings
strcollcompares two strings in accordance to the current locale
strchrfinds the first occurrence of a character
strrchrfinds the last occurrence of a character
strspnreturns the length of the maximum initial segment that consists of only the characters found in another byte string
strcspnreturns the length of the maximum initial segment that consists of only the characters not found in another byte string
strpbrkfinds the first location of any character in one string, in another string
strstrfinds the first occurrence of a substring of characters
strtok
strtok_s(C11)
finds the next token in a byte string

Memory manipulation:
memchrsearches an array for the first occurrence of a character
memcmpcompares two buffers
memset
memset_s(C11)
fills a buffer with a character
memcpy
memcpy_s(C11)
copies one buffer to another
memmove
memmove_s(C11)
moves one buffer to another

Miscellaneous:
strerror
strerror_s(C11)
strerrorlen_s(C11)
returns a text version of a given error code

The <string.h> header shall define the following type:
size_t Unsigned integral type



Related topics:
<setdef.h>   |   <stdint.h>   |   <stdio.h>   |   <stdlib.h>   |   <stdnoreturn.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stdnoreturn

The <stdnoreturn.h> header for specifying non-returning functions.

The < stdnoreturn.h> header shall define the following macro constant:
noreturn convenience macro, expands to _Noreturn (C11)



Related topics:
<setdef.h>   |   <stdint.h>   |   <stdio.h>   |   <stdlib.h>   |   <string.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stdlib

The <stdlib.h> header defines several general operation functions and macros.

The <stdlib.h> header shall define the following macro constant:
EXIT_SUCCESS
EXIT_FAILURE
indicates program execution execution status
MB_CUR_MAXMaximum size of multibyte characters
NULLNull pointer
RAND_MAXmaximum possible value generated by rand()

The <stdlib.h> header shall define the following functions:
String conversion:
atofconverts a byte string to a floating point value
atoi
atol
atoll
converts a byte string to an integer value int, long, long long(C99)
strtol
strtoll
converts a byte string to an integer value long, long long(C99)
strtoul
strtoull
converts a byte string to an unsigned integer value long, long long(C99)
strtof
strtod
strtold
converts a byte string to a floating point value float(C99), double, long double(C99)

Pseudo-random sequence generation:
randgenerates a pseudo-random number
srandseeds pseudo-random number generator

Dynamic memory management:
mallocallocates memory
callocallocates and zeroes memory
reallocexpands previously allocated memory block
freedeallocates previously allocated memory
aligned_allocallocates aligned memory (C11)

Environment:
abortcauses abnormal program termination (without cleaning up)
exitcauses normal program termination with cleaning up
quick_exitcauses normal program termination without completely cleaning up (C11)
_Exitcauses normal program termination without cleaning up (C99)
atexitregisters a function to be called on exit() invocation
at_quick_exitregisters a function to be called on quick_exit invocation (C11)
systemcalls the host environment's command processor
getenv
getenv_s(C11)
access to the list of environment variables

Searching and sorting:
bsearchBinary search in array
qsortSort elements of array

Integer arithmetics:
absAbsolute value
divIntegral division
labs Absolute value
ldiv Integral division
llabs Absolute value
lldiv Integral division

Multi-byte characters:
mblenreturns the number of bytes in the next multibyte character
mbtowcconverts the next multibyte character to wide character
wctomb
wctomb_s(C11)
converts a wide character to its multibyte representation

Multibyte strings:
mbstowcs
mbstowcs_s(C11)
converts a narrow multibyte character string to wide string
wcstombs
wcstombs_s(C11)
converts a wide string to narrow multibyte character string

The <stdlib.h> header shall define the following type:
div_tStructure returned by div(struct)
ldiv_tStructure returned by ldiv(struct)
lldiv_tStructure returned by lldiv(struct)
size_tUnsigned integral type



Related topics:
<setdef.h>   |   <stdint.h>   |   <stdio.h>   |   <stdnoreturn.h>   |   <string.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stdio

The <stdio.h> header provides functions for performing input and output.

The <stdio.h> header shall define the following macro constant:
EOFA negative integer of type int used to indicate end-of-file conditions
BUFSIZAn integer which is the size of the buffer used by the setbuf() function
FILENAME_MAX The size of a char array which is large enough to store the name of any file that can be opened
FOPEN_MAX The number of files that may be open simultaneously; will be at least eight
_IOFBF An abbreviation for "input/output fully buffered"; it is an integer which may be passed to the setvbuf() function to request block buffered input and output for an open stream
_IOLBF An abbreviation for "input/output line buffered"; it is an integer which may be passed to the setvbuf() function to request line buffered input and output for an open stream
_IONBF An abbreviation for "input/output not buffered"; it is an integer which may be passed to the setvbuf() function to request unbuffered input and output for an open stream
stdin expression of type FILE* associated with the input stream
stdout expression of type FILE* associated with the output stream
stderr expression of type FILE* associated with the error output stream
NULL A macro expanding to the null pointer constant; that is, a constant representing a pointer value which is guaranteed not to be a valid address of an object in memory
SEEK_CUR An integer which may be passed to the fseek() function to request positioning relative to the current file position
SEEK_END An integer which may be passed to the fseek() function to request positioning relative to the end of the file
SEEK_SET An integer which may be passed to the fseek() function to request positioning relative to the beginning of the file
TMP_MAX The maximum number of unique filenames generable by the tmpnam() function; will be at least 25
TMP_MAX_S maximum number of unique filenames that can be generated by tmpnam_s(C11)
L_tmpnam The size of a char array which is large enough to store a temporary filename generated by the tmpnam() function
L_tmpnam_s size needed for an array of char to hold the result of tmpnam_s

The <stdio.h> header shall define the following functions:
Operations on files:
removeerases a file
renamerenames a file
tmpfile
tmpfile_s
returns a pointer to a temporary file (C11)
tmpnam
tmpnam_s
returns a unique filename (C11)

File access:
fopen
fopen_s(C11)
opens a file 
freopen
freopen_s(C11)
open an existing stream with a different name
fclosecloses a file
fflushsynchronizes an output stream with the actual file
setbufsets the buffer for a file stream
setvbufsets the buffer and its size for a file stream

Formatted input/output:
scanf
fscanf
sscanf
scanf_s(C11)
fscanf_s(C11)
sscanf_s(C11)
reads formatted input from stdin, a file stream or a buffer
vscanf(C99)
vfscanf(C99)
vsscanf(C99)
vscanf_s(C11)
vfscanf_s(C11)
vsscanf_s(C11)
reads formatted input from stdin, a file stream or a buffer using variable argument list
printf
fprintf
sprint
snprintf(C99)
printf_s(C11)
fprintf_s(C11)
sprintf_s(C11)
snprintf_s(C11)
prints formatted output to stdout, a file stream or a buffer
vprintf
vfprintf
vsprintf
vsnprintf(C99)
vprintf_s(C11)
vfprintf_s(C11)
vsprintf_s(C11)
vsnprintf_s(C11)
prints formatted output to stdout, a file stream or a buffer using variable argument list

Character input/output:
fgetc
getc
gets a character from a file stream
fgetsgets a character string from a file stream
fputc
putc
writes a character to a file stream
fputswrites a character string to a file stream
getcharreads a character from stdin
gets
gets_s(C11)
reads a character string from stdin
putcharwrites a character to stdout
putswrites a character string to stdout
ungetcputs a character back into a file stream

Direct input/output:
freadreads from a file
fwritewrites to a file

File positioning:
ftellreturns the current file position indicator
fgetposgets the file position indicator
fseekmoves the file position indicator to a specific location in a file
fsetposmoves the file position indicator to a specific location in a file
rewindmoves the file position indicator to the beginning in a file

Error-handling:
clearerrclears errors
feofchecks for the end-of-file
ferrorchecks for a file error
perrordisplays a character string corresponding of the current error to stderr

The <stdio.h> header shall define the following type:
FILE type, capable of holding all information needed to control a C I/O stream
fpos_t type, capable of uniquely specifying a position and mutibyte parser state in a file
size_tUnsigned integral type



Related topics:
<setdef.h>   |   <stdint.h>   |   <stdlib.h>   |   <stdnoreturn.h>   |   <string.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stdint

The <stdint.h> header defines exact width integer types.

The <stdint.h> header shall define the following macro constants:

INT8_MIN
INT16_MIN
INT32_MIN
INT64_MIN
minimum value of an object of type int8_t, int16_t, int32_t, int64_t (C99)
INT8_MAX
INT16_MAX
INT32_MAX
INT64_MAX
maximum value of an object of type int8_t, int16_t, int32_t, int64_t(C99)
UINT8_MAX
UINT16_MAX
UINT32_MAX
UINT64_MAX
maximum value of an object of type uint8_t, uint16_t, uint32_t, uint64_t (C99)
INT_FAST8_MIN
INT_FAST16_MIN
INT_FAST32_MIN
INT_FAST64_MIN
minimum value of an object of type int_fast8_t, int_fast16_t, int_fast32_t, int_fast64_t (C99)
INT_FAST8_MAX
INT_FAST16_MAX
INT_FAST32_MAX
INT_FAST64_MAX
maximum value of an object of type int_fast8_t, int_fast16_t, int_fast32_t, int_fast64_t(C99)
UINT_FAST8_MAX
UINT_FAST16_MAX
UINT_FAST32_MAX
UINT_FAST64_MAX
maximum value of an object of type uint_fast8_t, uint_fast16_t, uint_fast32_t, uint_fast64_t (C99)
INT_LEAST8_MIN
INT_LEAST16_MIN
INT_LEAST32_MIN
INT_LEAST64_MIN
minimum value of an object of type int_least8_t, int_least16_t, int_least32_t, int_least64_t (C99)
INT_LEAST8_MAX
INT_LEAST16_MAX
INT_LEAST32_MAX
INT_LEAST64_MAX
maximum value of an object of type int_least8_t, int_least16_t, int_least32_t, int_least64_t(C99)
UINT_LEAST8_MAX
UINT_LEAST16_MAX
UINT_LEAST32_MAX
UINT_LEAST64_MAX
maximum value of an object of type uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t(C99)
INTPTR_MIN minimum value of an object of type intptr_t (C99)
INTPTR_MAX maximum value of an object of type intptr_t (C99)
UINTPTR_MAX maximum value of an object of type uintptr_t (C99)
INTMAX_MIN minimum value of an object of type intmax_t (C99)
INTMAX_MAX maximum value of an object of type intmax_t (C99)
UINTMAX_MAX maximum value of an object of type uintmax_t (C99)

The <stdint.h> header shall define the following functions:
INT8_C
INT16_C
INT32_C
INT64_C
expands to an integer constant expression having the value specified by its argument and the type int_least8_t, int_least16_t, int_least32_t, int_least64_t respectively (function macro) (C99)
UINT8_C
UINT16_C
UINT32_C
UINT64_C
expands to an integer constant expression having the value specified by its argument and the type uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t respectively (function macro) (C99)
INTMAX_C expands to an integer constant expression having the value specified by its argument and the type intmax_t (function macro) (C99)
UINTMAX_C expands to an integer constant expression having the value specified by its argument and the type uintmax_t (function macro) (C99)

The <stdint.h> header shall define the following type:
int8_t
int16_t
int32_t
int64_t
signed integer type with width of exactly 8, 16, 32 and 64 bits respectively with no padding bits and using 2's complement for negative values (provided only if the implementation directly supports the type) (C99)
uint8_t
uint16_t
uint32_t
uint64_t
unsigned integer type with width of exactly 8, 16, 32 and 64 bits respectively (provided only if the implementation directly supports the type) (C99)
int_fast8_t
int_fast16_t
int_fast32_t
int_fast64_t
fastest signed integer type with width of at least 8, 16, 32 and 64 bits respectively (C99)
uint_fast8_t
uint_fast16_t
uint_fast32_t uint_fast64_t
fastest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively (C99)
int_least8_t
int_least16_t
int_least32_t
int_least64_t
smallest signed integer type with width of at least 8, 16, 32 and 64 bits respectively (C99)
uint_least8_t
uint_least16_t
uint_least32_t
uint_least64_t
smallest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively (C99)
intmax_t maximum width integer type (C99)
uintmax_t maximum width unsigned integer type (C99)
intptr_t integer type capable of holding a pointer (C99)
uintptr_t unsigned integer type capable of holding a pointer (C99)



Related topics:
<setdef.h>   |   <stdio.h>   |   <stdlib.h>   |   <stdnoreturn.h>   |   <string.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stddef

The <stddef.h> header defines several standard definitions.

The <stddef.h> header shall define the following macro constants:
NULLimplementation-defined null pointer constant

The <stddef.h> header shall define the following function:
offsetofbyte offset from the beginning of a struct type to specified member (function macro)

The <stddef.h> header shall define the following type:
size_tunsigned integer type returned by the sizeof operator
ptrdiff_tsigned integer type returned when subtracting two pointers
max_align_t a type with alignment requirement as great as any other scalar type (C11)



Related topics:
<stdint.h>   |   <stdio.h>   |   <stdlib.h>   |   <stdnoreturn.h>   |   <string.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stdbool

The <stdbool.h> header defines Boolean data type.

The <stdbool.h> header shall define the following macros:
bool _Bool
true integer constant 1
false integer constant 0
__bool_true_false_are_defined integer constant 1.Specifies whether bool, true and false are defined



Related topics:
<setjmp.h>   |   <signal.h>   |   <stdalign.h>   |   <stdarg.h>   |   <stdatomic.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stdatomic

<stdatomic.h> header is for atomic operations on data shared between threads.

The <stdatomic.h> header shall define the following macro constants:
ATOMIC_FLAG_INIT initializes a new atomic_flag (C11)
ATOMIC_VAR_INIT initializes a new atomic object (C11)
ATOMIC_BOOL_LOCK_FREE
ATOMIC_CHAR_LOCK_FREE
ATOMIC_CHAR16_T_LOCK_FREE
ATOMIC_CHAR32_T_LOCK_FREE
ATOMIC_WCHAR_T_LOCK_FREE
ATOMIC_SHORT_LOCK_FREE
ATOMIC_INT_LOCK_FREE
ATOMIC_LONG_LOCK_FREE
ATOMIC_LLONG_LOCK_FREE
ATOMIC_POINTER_LOCK_FREE
indicates that the given atomic type is lock-free (C11)
kill_dependency breaks a dependency chain for memory_order_consume (C11)

The <stdatomic.h> header shall define the following functions:
atomic_flag_test_and_set
atomic_flag_test_and_set_explicit
sets an atomic_flag to true and returns the old value (C11)
atomic_flag_clear
atomic_flag_clear_explicit
sets an atomic_flag to false (C11)
atomic_init initializes an existing atomic object (C11)
atomic_is_lock_free indicates whether the atomic object is lock-free (C11)
atomic_store
atomic_store_explicit
stores a value in an atomic object (C11)
atomic_load
atomic_load_explicit
reads a value from an atomic object (C11)
atomic_exchange
atomic_exchange_explicit
swaps a value with the value of an atomic object (C11)
atomic_compare_exchange_strong
atomic_compare_exchange_strong_explicit
atomic_compare_exchange_weak
atomic_compare_exchange_weak_explicit
swaps a value with the an atomic object if the old value is what is expected, otherwise reads the old value (C11)
atomic_fetch_add
atomic_fetch_add_explicit
atomic addition (C11)
atomic_fetch_sub
atomic_fetch_sub_explicit
atomic subtraction (C11)
atomic_fetch_or
atomic_fetch_or_explicit
atomic logical OR (C11)
atomic_fetch_xor
atomic_fetch_xor_explicit
atomic logical exclusive OR (C11)
atomic_fetch_and
atomic_fetch_and_explicit
atomic logical AND (C11)
atomic_thread_fence generic memory order-dependent fence synchronization primitive (C11)
atomic_signal_fence fence between a thread and a signal handler executed in the same thread (C11)

The <stdatomic.h> header shall define the following type:
memory_order defines memory ordering constraints (enum) (C11)
atomic_flag lock-free atomic boolean flag (struct)(C11)
atomic_bool
atomic_char
atomic_schar
atomic_uchar
atomic_short
atomic_ushort
atomic_int
atomic_uint
atomic_long
atomic_ulong
atomic_llong
atomic_ullong
atomic_char16_t
atomic_char32_t
atomic_wchar_t
atomic_int_least8_t
atomic_uint_least8_t
atomic_int_least16_t
atomic_uint_least16_t
atomic_int_least32_t
atomic_uint_least32_t
atomic_int_least64_t
atomic_uint_least64_t
atomic_int_fast8_t
atomic_uint_fast8_t
atomic_int_fast16_t
atomic_uint_fast16_t
atomic_int_fast32_t
atomic_uint_fast32_t
atomic_int_fast64_t
atomic_uint_fast64_t
atomic_intptr_t
atomic_uintptr_t
atomic_size_t
atomic_ptrdiff_t
atomic_intmax_t
atomic_uintmax_t
Data type’s(C11)



Related topics:
<setjmp.h>   |   <signal.h>   |   <stdalign.h>   |   <stdarg.h>   |   <stdbool.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stdarg

<stdarg.h> header allows functions to accept an indefinite number of arguments.

The <stdarg.h> header shall define the following functions:
va_startenables access to variadic function arguments (function macro)
va_argaccesses the next variadic function argument (function macro)
va_copy makes a copy of the variadic function arguments (function macro) (C99)
va_endends traversal of the variadic function arguments (function macro)

The <stdarg.h> header shall define the following type:
va_listholds the information needed by va_start, va_arg, va_end, and va_copy



Related topics:
<setjmp.h>   |   <signal.h>   |   <stdalign.h>   |   <stdatomic.h>   |   <stdbool.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – stdalign

<stdalign.h> header is for querying and specifying the alignment of objects.

The <stdalign.h> header shall define the following macro constants:
alignas convenience macro, expands to keyword _Alignas (C11)
alignof convenience macro, expands to keyword _Alignof (C11)
__alignas_is_defined expands to integer constant 1 (C11)
__alignof_is_defined expands to integer constant 1 (C11)



Related topics:
<setjmp.h>   |   <signal.h>   |   <stdarg.h>   |   <stdatomic.h>   |   <stdbool.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – signal

The <signal.h> header provides a means to handle signals reported during a program's execution.

The <signal.h> header shall define the following macro constant:
SIG_DFL default signal handling
SIG_IGN The signal is ignored
SIG_ERRerror was encountered
SIGABRT Signal Abort
SIGFPE Signal Floating-Point Exception
SIGILL Signal Illegal Instruction
SIGINT Signal Interrupt
SIGSEGV Signal Segmentation Violation
SIGTERM Signal Terminate

The <signal.h> header shall define the following function:
signalsets a signal handler for particular signal
raiseruns the signal handler for particular signal

The <signal.h> header shall define the following type:
sig_atomic_tthe integer type that can be accessed as an atomic entity from an asynchronous signal handler /td>



Related topics:
<setjmp.h>   |   <stdalign.h>   |   <stdarg.h>   |   <stdatomic.h>   |   <stdbool.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – setjmp

The <setjmp.h> header provide non-local jumps. The <setjmp.h> header is used for controlling low-level calls and returns to and from functions.

The <setjmp.h> header shall define the following functions:
setjmpsaves the context (function macro)
longjmpjumps to specified location

The <setjmp.h> header shall define the following type:
jmp_bufexecution context type



Related topics:
<signal.h>   |   <stdalign.h>   |   <stdarg.h>   |   <stdatomic.h>   |   <stdbool.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – math

The <math.h> header defines several mathematic functions.

The <math.h> header shall define the following macro constants:
HUGE_VALF
HUGE_VAL
HUGE_VALL
indicates value too big to be representable (infinity) by float(C99), double and long double(C99) respectively
INFINITYevaluates to positive infinity or the value guaranteed to overflow a float (C99)
NANNot a Number - evaluates to a quiet NaN of type float (C99)
math_errhandling defines the error handling mechanism used by the common mathematical functions. (C99)
MATH_ERRNO
MATH_ERREXCEPT
Bitmask value with the possible values math_errhandling can take. (C99)
FP_FAST_FM
FP_FAST_FMAF
FP_FAST_FMAL
Each, if defined, identifies for which type fma is at least as efficient as x*y+z. (C99)
FP_INFINITE
FP_NAN
FP_NORMAL
FP_SUBNORMAL
FP_ZERO
The possible values returned by fpclassify. (C99)
FP_ILOGB0
FP_ILOGBNAN
Special values the ilogb function may return. (C99)

The <math.h> header shall define the following functions:
Trigonometric functions:
sin
sinf
sinl
computes sine (sin(x)) . double, float (C99) and long double (C99)
cos
cosf
cosl
computes cosine (cos(x)) . double, float (C99) and long double (C99)
tan
tanf
tanl
computes tangent (tan(x)) . double, float (C99) and long double (C99)
asin
asinf
asinl
computes arc sine (arcsin(x)) . double, float (C99) and long double (C99)
acos
acosf
acosl
computes arc cosine (arccos(x)) . double, float (C99) and long double (C99)
atan
atanf
atanl
computes arc tangent (arctan(x)) . double, float (C99) and long double (C99)
atan2
atan2f
atan2l
computes arc tangent, using signs to determine quadrants . double, float (C99) and long double (C99)

Hyperbolic functions:
sinh
sinhf
sinhl
computes hyperbolic sine (sh(x)) . double, float (C99) and long double (C99)
cosh
coshf
coshl
computes hyperbolic cosine (ch(x)) . double, float (C99) and long double (C99)
tanh
tanhf
tanhl
computes hyperbolic tangent . double, float (C99) and long double (C99)
asinh
asinhf
asinhl
computes inverse hyperbolic sine (arsinh(x)) (C99)
acosh
acoshf
acoshl
computes inverse hyperbolic cosine (arcosh(x)) (C99)
atanh
atanhf
atanhl
computes inverse hyperbolic tangent (artanh(x)) (C99)

Exponential and logarithmic functions:
exp
expf
expl
computes e raised to the given power (ex) . double, float (C99) and long double (C99)
exp2
exp2f
exp2l
computes 2 raised to the given power (2x) . (C99)
expml
expm1f
expm1l
computes e raised to the given power, minus one (ex-1) . (C99)
log
logf
logl
computes natural (base-e) logarithm (ln(x)) . double, float (C99) and long double (C99)
log10
log10f
log10l
computes common (base-10) logarithm (log10(x)) . double, float (C99) and long double (C99)
log2
log2f
log2l
computes base-2 logarithm (log2(x)) . (C99)
log1p
log1pf
log1pl
computes natural (base-e) logarithm of 1 plus the given number (ln(1+x)) . (C99)

Power functions:
pow
powf
powl
computes a number raised to the given power (xy) . double, float (C99) and long double (C99)
sqrt
sqrtf
sqrtl
computes square root (√x) . double, float (C99) and long double (C99)
cbrt
cbrtf
cbrtl
computes cubic root (3√x) . (C99)
hypot
hypotf
hypotl
computes square root of the sum of the squares of two given numbers (√x2+y2) . (C99)

Error and gamma functions:
erf
erff
erfl
computes error function (C99)
erfc
erfcf
erfcl
computes complementary error function (C99)
tgamma
tgammaf
tgammal
computes gamma function (C99)
lgamma
lgammaf
lgammal
computes natural (base-e) logarithm of the gamma function (C99)

Nearest integer floating-point operations:
ceil
ceilf
ceill
computes smallest integer not less than the given value .double, float (C99) and long double (C99)
floor
floorf
floorl
computes largest integer not greater than the given value .double, float (C99) and long double (C99)
trunc
truncf
truncl
rounds to nearest integer not greater in magnitude than the given value (C99)
round
lround
llround
rounds to nearest integer, rounding away from zero in halfway cases (C99)
nearbyint
nearbyintf
nearbyintl
rounds to an integer using current rounding mode (C99)
rint
rintf
rintl
lrint
lrintf
lrintl
llrint
llrintf
llrintl
rounds to an integer using current rounding mode with exception if the result differs (C99)

Floating-point manipulation functions:
frexp
frexpf
frexpl
breaks a number into significand and a power of 2 .double, float (C99) and long double (C99)
ldexp
ldexpf
ldexpl
multiplies a number by 2 raised to a power .double, float (C99) and long double (C99)
modf
modff
modfl
breaks a number into integer and fractional parts .double, float (C99) and long double (C99)
scalbn
scalbnf
scalbnl
scalbln
scalblnf
scalblnl
computes efficiently a number times FLT_RADIX raised to a power (C99)
ilogb
ilogbf
ilogbl
extracts exponent of the given number (C99)
logb
logbf
logbl
extracts exponent of the given number (C99)
nextafter
nextafterf
nextafterl
nexttoward
nexttowardf
nexttowardl
determines next representable floating-point value towards the given value (C99)
copysign
copysignf
copysignl
produces a value with the magnitude of a given value and the sign of another given value (C99)

Basic operations:
fabs
fabsf
fabsl
computes absolute value of a floating-point value (|x|). double, float (C99) and long double (C99)
fmod
fmodf
fmodl
computes remainder of the floating-point division operation . double, float (C99) and long double (C99)
remainder
remainderf
remainderl
computes signed remainder of the floating-point division operation (C99)
remquo
remquof
remquol
computes signed remainder as well as the three last bits of the division operation (C99)
fma
fmaf
fmal
computes fused multiply-add operation (C99)
fmax
fmaxf
fmaxl
determines larger of two floating-point values (C99)
fmin
fminf
fminl
determines smaller of two floating-point values (C99)
fdim
fdimf
fdiml
determines positive difference of two floating-point values (max(0, x-y)) (C99)
nan
nanf
nanl
returns a NaN (not-a-number) (C99)

Classification and comparison:
fpclassify classifies the given floating-point value (C99)
isfinite checks if the given number has finite value (C99)
isinf checks if the given number is infinite (C99)
isnan checks if the given number is NaN (C99)
isnormal checks if the given number is normal (C99)
signbit checks if the given number is negative (C99)
isgreater checks if the first floating-point argument is greater than the second (C99)
isgreaterequal checks if the first floating-point argument is greater or equal than the second (C99)
isless checks if the first floating-point argument is less than the second (C99)
islessequal checks if the first floating-point argument is less or equal than the second (C99)
islessgreater checks if the first floating-point argument is less or greater than the second (C99)
isunordered checks if two floating-point values are unordered (C99)

The <math.h> header shall define the following types:
float_t most efficient floating-point type at least as wide as float (C99)
double_t most efficient floating-point type at least as wide as double (C99)



Related topics:
<float.h>   |   <inttypes.h>   |   <iso646.h>   |   <limits.h>   |   <locale.h>   |   Standard Library in C

List of topics: C Programming


C Library Header – locale

The <locale.h> header is useful for setting location specific information.

The <locale.h> header shall define the following functions:
setlocalegets and sets the current C locale
localeconvqueries numeric and monetary formatting details of the current locale

The <locale.h> header shall define the following struct type:
lconvformatting details, returned by localeconv



Related topics:
<float.h>   |   <inttypes.h>   |   <iso646.h>   |   <limits.h>   |   <math.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – limits

This header defines constants with the limits of fundamental integral types. These values are implementation-specific.

The <limits.h> header shall define the following macro constants:
CHAR_BIT number of bits in byte
MB_LEN_MAX maximum number of bytes in a multibyte character
CHAR_MIN minimum value of char
CHAR_MAX maximum value of char
SCHAR_MIN
SHRT_MIN
INT_MIN
LONG_MIN
LLONG_MIN
minimum value of signed char, short, int, long and long long(C99) respectively
SCHAR_MAX
SHRT_MAX
INT_MAX
LONG_MAX
LLONG_MAX
maximum value of signed char, short, int, long and long long(C99) respectively
UCHAR_MAX
USHRT_MAX
UINT_MAX
ULONG_MAX
ULLONG_MAX
maximum value of unsigned char, unsigned short, unsigned int, unsigned long and unsigned long long(C99) respectively



Related topics:
<float.h>   |   <inttypes.h>   |   <iso646.h>   |   <locale.h>   |   <math.h>   |   Standard Library in C

List of topics: C Programming

C Library Header - iso646

Header <iso646.h> defines C alternative tokens. It refers to refer to a set of alternative spellings of common operators in C. The alternative tokens allow programmers to use C language bitwise and logical operators which could otherwise be hard to type on some international and non-QWERTY keyboards.

Alternative Spellings:
Primary Alternative
&& and
&= and_eq
& bitand
| bitor
~ compl
! not
!= not_eq
|| or
|= or_eq
^ xor
^= xor_eq

Digraphs and trigraphs:
Primary Digraph Trigraph
{ <% ??<
} %> ??>
[ <: td="">??(
] :> ??)
# %: ??=
\ ??/
^ ??'
| ??!
~ ??-



Related topics:
<float.h>   |   <inttypes.h>   |   <limits.h>   |   <locale.h>   |   <math.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – inttypes

The <inttypes.h> header provides features that enhance the functionality of the types defined in <stdint.h>

Printf format string - The macros are in the format PRI{fmt}{type}. Here {fmt} defines the output formatting and is one of d (decimal), x (hexadecimal), o (octal), u (unsigned) and i (integer). {type} defines the type of the argument and is one of N, FASTN, LEASTN, PTR, MAX, where N corresponds to the number of bits in the argument.

Scanf format string - The macros are in the format SCN{fmt}{type}. Here {fmt} defines the output formatting and is one of d (decimal), x (hexadecimal), o (octal), u (unsigned) and i (integer). {type} defines the type of the argument and is one of N, FASTN, LEASTN, PTR, MAX, where N corresponds to the number of bits in the argument.

The <inttypes.h> header shall define the following macro constants:
PRIxMAX printf specifier for intmax_t
PRIxN printf specifier for intN_t
PRIxLEASTN printf specifier for int_leastN_t
PRIxFASTN printf specifier for int_fastN_t
PRIxPTR printf specifier for intptr_t
SCNxMAX scanf specifier for intmax_t
SCNxN scanf specifier for intN_t
SCNxLEASTN scanf specifier for int_leastN_t
SCNxFASTN scanf specifier for int_fastN_t
SCNxPTR scanf specifier for intptr_t

Where:
•    x is one of d, i, o,u or x (for the printf specifiers this can also be an uppercase X). The specifier assumes the type to be signed for i and d, and unsigned for o, u, x and X.
•    N is 8, 16, 32, 64, or any other type width supported by the library in <cstdint>.

The <inttypes.h> header shall define the following functions:
imaxabs equivalent to abs for intmax_t
imaxdiv equivalent to div for intmax_t
strtoimax equivalent to strtol for intmax_t
strtoumax equivalent to strtoul for uintmax_t
wcstoimax equivalent to wcstol for intmax_t
wcstoumax equivalent to wcstoul for uintmax_t

The <inttypes.h> header shall define the following type:
imaxdiv_t Type returned by imaxdiv, which is the div_t equivalent for intmax_t



Related topics:
<float.h>   |   <iso646.h>   |   <limits.h>   |   <locale.h>   |   <math.h>   |   Standard Library in C

List of topics: C Programming

C Library Header – float

<float.h> header describes the characteristics of floating types for the specific system.

The <float.h> header shall define the following macro constants:
FLT_RADIX the radix (integer base) used by the representation of all three floating-point types
DECIMAL_DIG number of decimal digits that can be converted to long double and back without losing precision(C99)
FLT_DECIMAL_DIG
DBL_DECIMAL_DIG
LDBL_DECIMAL_DIG
number of decimal digits such that any floating-point number can be rounded to a floating-point number with this many decimal digits and back again without change to the value. Defined to at least 6, 10, and 10 respectively. (C11)
FLT_MIN
DBL_MIN
LDBL_MIN
minimum normalized positive value of float, double, long double respectively
FLT_TRUE_MIN
DBL_TRUE_MIN
LDBL_TRUE_MIN
minimum positive value of float, double, long double respectively (C11)
FLT_MAX
DBL_MAX
LDBL_MAX
maximum finite value of float, double, long double, respectively
FLT_EPSILON
DBL_EPSILON
LDBL_EPSILON
difference between 1.0 and the next representable value for float, double and long double respectively
FLT_DIG
DBL_DIG
LDBL_DIG
number of decimal digits that can be represented without losing precision for float, double and long double respectively
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
number of base-FLT_RADIX digits that are in the floating-point mantissa and that can be represented without losing precision for float, double and long double respectively
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
minimum negative integer such that FLT_RADIX raised by power one less than that integer is a normalized float, double and long double respectively
FLT_MIN_10_EXP
DBL_MIN_10_EXP
LDBL_MIN_10_EXP
minimum negative integer such that 10 raised by power one less than that integer is a normalized float, double and long double respectively
FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
maximum positive integer such that FLT_RADIX raised by power one less than that integer is a normalized float, double and long double respectively
FLT_MAX_10_EXP
DBL_MAX_10_EXP
LDBL_MAX_10_EXP
maximum positive integer such that 10 raised by power one less than that integer is a normalized float, double and long double respectively
FLT_ROUNDSrounding mode of floating-point arithmetics, equal to float_round_style
FLT_EVAL_METHODuse of extended precision for intermediate results: 0 not used, 1 double is used instead of float, 2: long double is used (C99)
FLT_HAS_SUBNORM
DBL_HAS_SUBNORM
LDBL_HAS_SUBNORM
whether the type supports subnormal (denormal) numbers: -1 indeterminable, 0 absent, 1 present (C11)



Related topics:
<assert.h>   |   <complex.h>   |   <ctype.h>   |   <errno.h>   |   <fenv.h>   |   Standard Library in C

List of topics: C Programming