Arithmetic Functions in C

Arithmetic, conversion, classification, manipulation, searching, and sorting functions in C programming with descriptions are listed below. You can use the following functions to work with values.

Arithmetic Functions

Function Use
abs Returns the absolute value of an integer.
cos Calculates cosine.
cosh Calculates hyperbolic cosine.
exp Raises the exponential e to the xth power.
fabs Finds absolute value.
floor Finds largest integer less than or equal to argument.
fmod Finds floating-point remainder.
hypot Calculates hypotenuse of right triangle.
log Calculates natural logarithm.
log10 Calculates base 10 logarithm.
modf Breaks down argument into integer and fractional parts.
pow Calculates a value raised to a power.
sin Calculates sine.
sinh Calculates hyperbolic sine.
sqrt Finds square root.
tan Calculates tangent.
tanh Calculates hyperbolic tangent.

Data Conversion Functions

Function Use
atof Converts string to float.
atoi Converts string to int.
atol Converts string to long.
ecvt Converts double to string.
fcvt Converts double to string.
gcvt Converts double to string.
itoa Converts int to string.
ltoa Converts long to string.
strtod Converts string to double.
strtol Converts string to long integer.
strtoul Converts string to an unsigned long integer.
ultoa Converts unsigned long to string.

Character Classification Functions

Function Use
isalnum Tests for alphanumeric character.
isalpha Tests for alphabetic character.
isdigit Tests for decimal digit.
islower Tests for lowercase character.
isspace Tests for white space character.
isupper Tests for uppercase character.
isxdigit Tests for hexadecimal digit.
tolower Tests character and converts to lowercase if uppercase.
toupper Tests character and converts to uppercase if lowercase.

String Manipulation Functions
Function Use
strcat Appends one string to another.
strchr Finds first occurrence of a given character in a string.
strcmp Compares two strings.
strcmpi Compares two strings without regard to case.
strcpy Copies one string to another.
strdup Duplicates a string.
stricmp Compares two strings without regard to case (identical to strcmpi).
strlen Finds length of a string.
strlwr Converts a string to lowercase.
strncat Appends a portion of one string to another.
strncmp Compares a portion of one string with portion of another string.
strncpy Copies a given number of characters of one string to another.
strnicmp Compares a portion of one string with a portion of another without regard to case.
strrchr Finds last occurrence of a given character in a string.
strrev Reverses a string.
strset Sets all characters in a string to a given character.
strstr Finds first occurrence of a given string in another string.
strupr Converts a string to uppercase.

Searching and Sorting Functions
Function Use
bsearch Performs binary search.
lfind Performs linear search for a given value.
qsort Performs quick sort.