C Standard Library Functions Reference

A

  • abortCauses abnormal program termination.
  • absComputes the absolute value of an integer.
  • acosCalculates the arc cosine of the specified number.
  • asctimeConverts a time structure to a string representation.
  • asctime_rThread-safe version of asctime.
  • asinCalculates the arc sine of the specified number.
  • assertTests the given condition and causes a program abort if false.
  • atanCalculates the arc tangent of the specified number.
  • atan2Calculates the arc tangent of two variables representing the quotient.
  • atexitRegisters a function to be called at program termination.
  • atofConverts a string to a floating-point number.
  • atoiConverts a string to an integer.
  • atolConverts a string to a long integer.

B

  • bsearchPerforms binary search over an array.
  • btowcConverts a single-byte character to a wide character.

C

  • callocAllocates memory for an array of elements, initializing them to zero.
  • catcloseCloses a message catalog.
  • catgetsReads a string from a message catalog.
  • catopenOpens a message catalog.
  • ceilCalculates the smallest integer value greater than or equal to the argument.
  • clearerrClears the error and end-of-file indicators for a given stream.
  • clockReturns the processor time consumed by the program.
  • cosCalculates the cosine of the specified angle in radians.
  • coshCalculates the hyperbolic cosine of the specified number.
  • ctimeConverts the calendar time to a local time string.
  • ctime_rThread-safe version of ctime.

D

  • difftimeComputes the difference in seconds between two times.
  • divDivides two integers and returns both the quotient and remainder.

E

  • erfCalculates the error function of the specified number.
  • erfcCalculates the complementary error function of the specified number.
  • exitTerminates the program and returns control to the host environment.
  • expCalculates the exponential function e raised to the power of the specified number.

F

  • fabsCalculates the absolute value of a floating-point number.
  • fcloseCloses the file pointed to by the file pointer.
  • fdopenAssociates a file descriptor with an input/output stream.
  • feofChecks if the end of the file has been reached.
  • ferrorChecks for an error in file streams.
  • fflushFlushes the output buffer of a file stream.
  • fgetcReads the next character from the specified file stream.
  • fgetposGets the current file position of the stream and stores it in a position indicator.
  • fgetsReads a line from the specified stream and stores it into the string pointed to by str.
  • fgetwcReads a wide character from the given input stream.
  • fgetwsReads a line of wide characters from a stream.
  • filenoReturns the integer file descriptor associated with the file stream.
  • floorCalculates the largest integer value less than or equal to the specified number.
  • fmodCalculates the remainder of the division of two floating-point numbers.
  • fopenOpens the file named by filename and returns a stream associated with that file.
  • fprintfWrites formatted output to a stream.
  • fputcWrites a character to a file stream.
  • fputsWrites a string to a file stream.
  • fputwcWrites a wide character to a file stream.
  • fputwsWrites a wide-character string to a file stream.
  • freadReads data from the given stream into the array pointed to by ptr.
  • freeFrees the memory space pointed to by ptr, which must have been returned by a previous call to malloc or calloc.
  • freopenReopens the file stream with a different file or mode.
  • frexpDecomposes a floating-point number into its binary significand and an integral exponent for 2.
  • fscanfReads formatted input from a stream.
  • fseekSets the file position of the stream to the given offset.
  • fsetposSets the file position of the stream based on the position given by fpos_t.
  • ftellReturns the current file position of the stream.
  • fwideSets the orientation of the stream to wide or narrow.
  • fwprintfWrites formatted wide character output to a stream.
  • fwriteWrites data from the given array to the stream.
  • fwscanfReads formatted wide character input from a stream.

G

  • getcReads the next character from the specified stream.
  • getcharReads the next character from the standard input stream.
  • getenvRetrieves the value of an environment variable.
  • getwcGets a wide character from the specified stream.
  • getwcharReads the next wide character from the standard input stream.
  • gmtimeConverts the calendar time to broken-down time representation.
  • gmtime_rThread-safe version of gmtime.

H

  • hypotCalculates the hypotenuse of a right-angled triangle given its legs.

I

  • isalnumChecks whether the character is alphanumeric.
  • isalphaChecks whether the character is alphabetic.
  • isasciiChecks whether the character is an ASCII character.
  • isblankChecks whether the character is a blank character (space or tab).
  • iscntrlChecks whether the character is a control character.
  • isdigitChecks whether the character is a decimal digit.
  • isgraphChecks whether the character has a graphical representation.
  • islowerChecks whether the character is lowercase.
  • isprintChecks whether the character is printable, including space.
  • ispunctChecks whether the character is a punctuation character.
  • isspaceChecks whether the character is a white-space character.
  • isupperChecks whether the character is an uppercase letter.
  • iswalnumChecks whether the wide character is alphanumeric.
  • iswalphaChecks whether the wide character is alphabetic.
  • iswblankChecks whether the wide character is a blank (space or tab).
  • iswcntrlChecks whether the wide character is a control character.
  • iswctypeChecks whether the wide character conforms to the specified type.
  • iswdigitChecks whether the wide character is a digit.
  • iswgraphChecks whether the wide character has a graphical representation.
  • iswlowerChecks whether the wide character is lowercase.
  • iswprintChecks whether the wide character is printable, including space.
  • iswpunctChecks whether the wide character is a punctuation mark.
  • iswspaceChecks whether the wide character is a whitespace character.
  • iswupperChecks whether the wide character is uppercase.
  • iswxdigitChecks whether the wide character is a hexadecimal digit.
  • isxdigitChecks whether the character is a hexadecimal digit.

J

  • j0Computes the Bessel function of the first kind of order 0.
  • j1Computes the Bessel function of the first kind of order 1.
  • jnComputes the Bessel function of the first kind of order n.

L

  • labsComputes the absolute value of a long integer.
  • ldexpMultiplies a floating-point number by an integral power of 2.
  • ldivDivides two long integers and returns the quotient and remainder.
  • localeconvReturns a pointer to the current locale's formatting settings.
  • localtimeConverts calendar time to local time.
  • localtime_rThread-safe version of localtime.
  • logCalculates the natural logarithm of the specified number.
  • log10Calculates the base-10 logarithm of the specified number.
  • longjmpRestores the environment saved by setjmp with a specified return value.

M

  • mallocAllocates a specified amount of memory and returns a pointer to it.
  • mblenReturns the number of bytes in the next multibyte character.
  • mbrlenDetermines the number of bytes in a multibyte character, given state.
  • mbrtowcConverts a multibyte sequence to a wide character.
  • mbsinitChecks if the multibyte state object is in the initial state.
  • mbsrtowcsConverts a multibyte string to a wide character string.
  • mbstowcsConverts a multibyte string to a wide character string, not dependent on the current locale.
  • mbtowcConverts a multibyte sequence to a single wide character.
  • memchrSearches for the first occurrence of a character in a block of memory.
  • memcmpCompares two blocks of memory.
  • memcpyCopies one block of memory to another.
  • memmoveCopies one block of memory to another, safely handling overlapping memory areas.
  • memsetFills a block of memory with a specified value.
  • mktimeConverts a time structure to calendar time.
  • modfBreaks a floating-point number into integer and fractional parts.

N

  • nextafterReturns the next representable value of the first argument in the direction of the second argument.
  • nextafterlReturns the next representable long double value of the first argument in the direction of the second argument.
  • nexttowardReturns the next representable value of the first argument towards the second argument, specified as a long double.
  • nexttowardlReturns the next representable long double value of the first argument towards the second argument, specified as a long double.
  • nl_langinfoRetrieves information about the current locale specified by the item.

P

  • perrorPrints a descriptive error message to stderr based on the current value of the C global variable errno.
  • powCalculates the power of one number raised to another, i.e., base raised to the exponent.
  • printfPrints formatted output to the standard output stream.
  • putcWrites a character to the specified stream.
  • putcharWrites a character to the standard output stream.
  • putenvChanges or adds a value to the environment.
  • putsWrites a string followed by a newline to the standard output stream.
  • putwcWrites a wide character to the specified stream.
  • putwcharWrites a wide character to the standard output stream.

Q

  • qsortSorts an array of elements using the quicksort algorithm.
  • quantexpd32Determines the exponent of a decimal floating-point number (_Decimal32). Note: This is part of the optional decimal floating-point arithmetic support.
  • quantexpd64Determines the exponent of a decimal floating-point number (_Decimal64). Note: This is part of the optional decimal floating-point arithmetic support.
  • quantexpd128Determines the exponent of a decimal floating-point number (_Decimal128). Note: This is part of the optional decimal floating-point arithmetic support.
  • quantized32Quantizes a decimal floating-point number (_Decimal32) to the same exponent as another. Note: This is part of the optional decimal floating-point arithmetic support.
  • quantized64Quantizes a decimal floating-point number (_Decimal64) to the same exponent as another. Note: This is part of the optional decimal floating-point arithmetic support.
  • quantized128Quantizes a decimal floating-point number (_Decimal128) to the same exponent as another. Note: This is part of the optional decimal floating-point arithmetic support.

R

  • raiseSends a signal to the current process.
  • randGenerates a pseudo-random number.
  • rand_rGenerates a pseudo-random number using a given seed, thread-safe.
  • reallocChanges the size of the memory block pointed to by ptr.
  • regcompCompiles a regular expression into a form that can be used for pattern matching.
  • regerrorProduces a human-readable error message based on the error code from regcomp or regexec.
  • regexecMatches a null-terminated string against the precompiled pattern buffer specified by regex_t.
  • regfreeFrees any memory allocated by regcomp for the compiled regular expression.
  • removeDeletes a file.
  • renameRenames a file or directory.
  • rewindSets the file position to the beginning of the file stream.

S

  • samequantumd32Checks if two _Decimal32 numbers have the same quantization (exponent). Note: This is part of the optional decimal floating-point arithmetic support.
  • samequantumd64Checks if two _Decimal64 numbers have the same quantization (exponent). Note: This is part of the optional decimal floating-point arithmetic support.
  • samequantumd128Checks if two _Decimal128 numbers have the same quantization (exponent). Note: This is part of the optional decimal floating-point arithmetic support.
  • scanfReads formatted input from the standard input stream.
  • setbufSets the buffer to be used by the stream for I/O operations.
  • setjmpSaves the calling environment for longjmp.
  • setlocaleSets or queries the program's locale.
  • setvbufSets a specific buffer and buffering mode for the given stream.
  • signalSets a function to handle a particular signal.
  • sinCalculates the sine of the specified angle in radians.
  • sinhCalculates the hyperbolic sine of the specified number.
  • snprintfWrites formatted output to a string with a length limit.
  • sprintfWrites formatted output to a string.
  • sqrtCalculates the square root of the specified number.
  • srandSeeds the pseudo-random number generator used by rand().
  • sscanfReads formatted input from a string.
  • strcasecmpCompares two strings ignoring the case of the characters.
  • strcatAppends the source string to the destination string.
  • strchrSearches for the first occurrence of the character in the string.
  • strcmpCompares two strings lexicographically.
  • strcollCompares two strings using the current locale.
  • strcpyCopies the source string to the destination string.
  • strcspnScans the first string for the first occurrence of any of the characters in the second string.
  • strerrorReturns a pointer to the textual representation of the current errno value.
  • strfmonFormats monetary values according to the locale settings.
  • strftimeFormats the time and date according to the locale settings and format string.
  • strlenCalculates the length of the string, excluding the null terminator.
  • strncasecmpCompares a specified number of characters from two strings, ignoring case.
  • strncatAppends a specified number of characters from the source string to the destination string.
  • strncmpCompares a specified number of characters from two strings.
  • strncpyCopies a specified number of characters from the source string to the destination string.
  • strpbrkSearches a string for the first occurrence of any of the characters in a specified string.
  • strptimeParses a time/date string according to the format string and stores the result in a tm structure.
  • strrchrSearches for the last occurrence of the character in the string.
  • strspnCalculates the length of the initial segment of the string which consists only of characters found in a specified string.
  • strstrFinds the first occurrence of the substring in the string.
  • strtodConverts the initial portion of the string to a double-precision floating-point number.
  • strtod32Converts the initial portion of the string to a decimal floating-point number with 32-bit precision.
  • strtod64Converts the initial portion of the string to a decimal floating-point number with 64-bit precision.
  • strtod128Converts the initial portion of the string to a decimal floating-point number with 128-bit precision.
  • strtofConverts the initial portion of the string to a floating-point number.
  • strtokTokenizes a string into sequences separated by the delimiters specified.
  • strtok_rA reentrant version of strtok that tokenizes a string into sequences using specified delimiters, storing the context.
  • strtolConverts the initial portion of the string to a long integer.
  • strtoldConverts the initial portion of the string to a long double.
  • strtoulConverts the initial portion of the string to an unsigned long integer.
  • strxfrmTransforms the string to another string such that the result of strcmp on these is the same as strcoll on the original strings.
  • swprintfWrites formatted wide character output to a string.
  • swscanfReads formatted input from a wide character string.
  • systemExecutes a command string in a command processor or shell.

T

  • tanCalculates the tangent of the specified angle in radians.
  • tanhCalculates the hyperbolic tangent of the specified number.
  • timeGets the current calendar time.
  • time64Gets the current calendar time as a 64-bit value, suitable for representing times beyond 2038.
  • tmpfileCreates a temporary binary file that is automatically deleted when closed or the program terminates.
  • tmpnamGenerates a unique temporary filename.
  • toasciiConverts a character to its ASCII equivalent.
  • tolowerConverts a character to lowercase.
  • toupperConverts a character to uppercase.
  • towctransApplies a specified transformation to a wide character, such as tolower or toupper.
  • towlowerConverts a wide character to lowercase.
  • towupperConverts a wide character to uppercase.

U

  • ungetcPushes a character back onto a stream, where it is available for subsequent read operations.
  • ungetwcPushes a wide character back onto a stream, where it is available for subsequent read operations.

V

  • va_argRetrieves the next argument in a function with a variable number of arguments.
  • va_copyCopies the content of one va_list to another.
  • va_endEnds traversal of the variable arguments, allowing a va_list to be reused.
  • va_startInitializes a va_list to retrieve the additional arguments passed to the function.
  • vfprintfPrints formatted output to the specified stream using a va_list.
  • vfscanfReads formatted input from a stream using a va_list.
  • vfwprintfWrites formatted wide character output to the specified stream using a va_list.
  • vfwscanfReads formatted wide character input from a stream using a va_list.
  • vprintfPrints formatted output to the standard output using a va_list.
  • vscanfReads formatted input from the standard input using a va_list.
  • vsprintfWrites formatted output to a string using a va_list.
  • vsnprintfWrites formatted output to a string with size limitation using a va_list.
  • vsscanfReads formatted data from a string using a va_list.
  • vswprintfWrites formatted wide character output to a string with size limitation using a va_list.
  • vswscanfReads formatted wide character input from a string using a va_list.
  • vwprintfPrints formatted wide character output to the standard output using a va_list.
  • vwscanfReads formatted wide character input from the standard input using a va_list.

W

  • wcrtombConverts a wide character to a multibyte sequence.
  • wcscatAppends a wide character string to the end of another wide character string.
  • wcschrSearches for the first occurrence of a wide character in a wide character string.
  • wcscmpCompares two wide character strings lexicographically.
  • wcscollCompares two wide character strings using the current locale's collation rules.
  • wcscpyCopies a wide character string to another wide character string.
  • wcscspnCalculates the length of the initial segment of the first wide character string which consists only of characters not in the second wide character string.
  • wcsftimeFormats the time and date as a wide character string according to the locale settings and format string.
  • wcslenCalculates the length of a wide character string, excluding the null terminator.
  • wcslocaleconvReturns a pointer to the structure containing locale-specific information, formatted as wide characters.
  • wcsncatAppends a specified number of wide characters from the source wide character string to the destination wide character string.
  • wcsncmpCompares a specified number of characters from two wide character strings.
  • wcsncpyCopies a specified number of characters from one wide character string to another, ensuring that the destination string will not be overrun.
  • wcspbrkSearches a wide character string for the first occurrence of any of the characters that are part of another wide character string.
  • wcsptimeParses a wide character string representing a time according to a format string and stores the information in a structure.
  • wcsrchrSearches for the last occurrence of a specified wide character in a wide character string.
  • wcsrtombsConverts a sequence of wide characters from a wide character string to a multibyte string, considering the current locale.
  • wcsspnCalculates the length of the initial segment of a wide character string which consists only of characters that are part of another wide character string.
  • wcsstrFinds the first occurrence of a specified wide substring in a wide character string.
  • wcstodConverts the initial portion of a wide character string to a double-precision floating-point number.
  • wcstod32Converts the initial portion of a wide character string to a decimal floating-point number with 32-bit precision.
  • wcstod64Converts the initial portion of a wide character string to a decimal floating-point number with 64-bit precision.
  • wcstod128Converts the initial portion of a wide character string to a decimal floating-point number with 128-bit precision.
  • wcstofConverts the initial portion of a wide character string to a floating-point number.
  • wcstokTokenizes a wide character string using specified delimiters, storing the context.
  • wcstolConverts the initial portion of a wide character string to a long integer.
  • wcstoldConverts the initial portion of a wide character string to a long double.
  • wcstombsConverts a wide character string to a multibyte character string.
  • wcstoulConverts the initial portion of a wide character string to an unsigned long integer.
  • wcsxfrmTransforms a wide character string such that the result of wcscmp on these transformed strings is the same as wcscoll on the original strings.
  • wctobAttempts to convert a wide character to a single-byte character.
  • wctombConverts a wide character to its multibyte representation.
  • wctransReturns a type that represents a class of wide characters that can be converted to each other (e.g., tolower, toupper).
  • wctypeReturns a value representing a class of wide characters according to a property name like 'alnum', 'alpha', etc.
  • wcwidthDetermines the number of column positions required for a wide character.
  • wmemchrSearches for a wide character in the first 'n' wide characters of a wide character array.
  • wmemcmpCompares the first 'n' wide characters of two wide character arrays.
  • wmemcpyCopies 'n' wide characters from one wide character array to another.
  • wmemmoveMoves 'n' wide characters from one wide character array to another, handling overlapping memory correctly.
  • wmemsetFills 'n' wide characters of a wide character array with a specified wide character.
  • wprintfPrints formatted wide character output to the standard output.
  • wscanfReads formatted wide character input from the standard input.

Y

  • y0Calculates the Bessel function of the second kind of order 0 for the given value.
  • y1Calculates the Bessel function of the second kind of order 1 for the given value.
  • ynCalculates the Bessel function of the second kind of order n for the given value.