Standard C language standard function library quick check (Cheat Sheet) __ function

Source: Internet
Author: User
Tags arithmetic assert locale lowercase mathematical functions pow time and date
Standard C language standard function library quick check (Cheat Sheet) DescriptionThis page contains the C language standard version of the 15 header file explanations as well as functions, 137 functions and demos, you can click on the function name to see.
It is not responsible for any errors arising from this page. This page is not necessarily guaranteed to continue to be updated. (View update Records)





C language standard head <assert.h> assertion <ctype.h> character class test <errno.h> (partial) library function throw error code <float.h> floating-point arithmetic < limits.h> detection Integer data type value range <locale.h> localization <math.h> math function <setjmp.h> "nonlocal jump" <signal.h> signal < Stdarg.h> variable parameter list <stddef.h> some constants, types and variables <stdio.h> input and Output <stdlib.h> practical function <string.h> String function < Time.h> time and date functions <assert.h> assertion header files <assert.h> The only purpose is to provide a definition of the macro assert. If the assertion is not true (expression==0), the program outputs the prompt in the standard error stream and causes the program exception to abort the call to abort ().
Definition: void assert (int expression);

#define NDEBUG
#include <assert.h>	
int main (int argc, char* argv[]) {
	int a =;
	int b =;
	ASSERT (a > B);
	printf ("A is larger than b!");
	return 0;
}
The above program will find that the program is aborted, printf is not executing, and there is this output: Main:assertion ' a > B ' failed. The reason is that a is actually less than B, causing the assertion to fail, assert output error message, and Invoke abort () to abort the program execution. <ctype.h> character Test<ctype.h> mainly provides two kinds of important functions: Character test function and character size conversion function. The supplied function takes an int type as a parameter and returns a value of type int. The argument type should be implicitly converted or the display cast to type int. int isalnum (int c); Judge whether it is a letter or a number. int isalpha (int c); Judge whether it is a letter. int Iscntrl (int c); Determine if it is a control character. int isdigit (int c); Judge whether it is a number. int isgraph (int c); Determines whether a character can be displayed. int islower (int c); Determine if it is a lowercase letter. int isupper (int c); Determine if it is a capital letter. int isprint (int c); Determines whether a character can be displayed. int ispunct (int c); Determines whether punctuation characters are. int isspace (int c); Determines whether the white space character int isxdigit (int c); Determines whether the character is 16-in-system.  int tolower (int c); Converted to lowercase letters.  int toupper (int c); Converted to uppercase letters. <errno.h> Error CodesError.h is the header file in the C standard function library, which defines a macro that returns an error message through an error code:

The errno macro is defined as the left value of an int type, containing the last error code generated by any function using the errno function.

A macro that represents the error code, defined as an integer value:
EDOM arguments originating from a function are out of range, such as sqrt (-1)
Erange results from function are out of range, such as S Trtol ("0xfffffffff", null,0)
Eilseq originates from an illegal character order, such as wcstombs (str, L "\XFFFF", 2) <float.h> Floating-point arithmeticThe float header file defines the maximum minimum floating-point value of a floating-point value as defined in the following manner: symbol-value E index symbol is positive or negative, value is numeric
The following values are defined with #define, and these values are detailed implementations, but may not be more detailed than the one given here.
In all instances, FLT refers to Float,dbl, DOUBLE,LDBL refers to a long double flt_rounds
Defines the way floating-point values are rounded,-1 is indeterminate, 0 is to 0,1, 2 is to positive infinity, and 3 is negative Infinity Flt_radix 2
Defines the basic representation of an exponent (for example, base-2 is binary, base-10 is decimal notation, 16 is hexadecimal) flt_mant_dig,dbl_mant_dig,ldbl_mant_dig
Defines the number of numbers in a number flt_dig 6,dbl_dig 10,ldbl_dig 10
Can not change the represented maximum number of digits after rounding Flt_min_exp,dbl_min_exp,ldbl_min_exp
Flt_radix the minimum negative integer value of the exponent flt_min_10_exp-37,dbl_min_10_exp-37,ldbl_min_10_exp-37
The minimum negative integer value of the exponent of the 10 notation Flt_max_exp, Dbl_max_exp, Ldbl_max_exp
Flt_radix the maximum integer value of the exponent flt_max_10_exp +37, dbl_max_10_exp, Ldbl_max_10_exp +37 +37
The maximum integer value of the exponent of the 10 notation Flt_max 1e+37,dbl_max 1e+37,ldbl_max 1E+37
Maximum limit of floating-point type Flt_epsilon 1e-5,dbl_epsilon 1e-9,ldbl_epsilon 1E-9
The smallest number of symbols that can be represented <limits.h> Value RangeChar_bit an ASCII character length schar_min character-type minimum schar_max character maximum Uchar_max unsigned character-type maximum char_min
Char_max
The maximum minimum value for char characters, if the char character Single-character is represented as a signed integer. Their values are the same as signed integers. Otherwise, the minimum value of the char character is 0, and the maximum value is the maximum value of the unsigned char character. Mb_len_max The maximum number of bytes for a single character shrt_min minimum short integer shrt_max max short shaping Ushrt_max max unsigned short integer int_min min integer int_max max shaping Uint_max max unsigned integral type Long_mi N Minimum Long integer long_max maximum long integral type Ulong_max unsigned long integer Localization of <locale.h>National, cultural, and language rule sets are called locales, and locale-related functions are defined in <locale.h> header files. The setlocale function is used to set or return the current region attribute, localeconv to return the number and currency information in the current zone (saved in the struct LCONV structure instance). The first argument of setlocale specifies the range behavior category to be changed, and the predefined setlocale categories are: Lc_all
All localized information lc_collate
Affect Strcoll and strxfrm lc_ctype
affect character processing functions and multiline character processing functions Lc_monetary
Affects currency formatting information returned by Localeconv Lc_numeric
Affects the decimal point symbol in formatted input-output characters Lc_time
2 functions are available in the impact Strftime function <locale.h> header file
SetLocale () to set or restore localized information
Localeconv () returns information setlocale (constant,location) usage for the current geographical setting
If the function succeeds, the current scene property is returned, or false if execution fails. constant  parameters (necessary parameters.) Specifies the set of scene information) lc_all – all subordinate constants lc_collate – order lc_ctype – character sorting and conversion (for example, converting all characters to lowercase or uppercase) lc_messages  – System Information Format lc_monetary – the currency/currency format lc_numeric – numeric format lc_time – date and time format location  (necessary parameters) necessary parameters. Specifies the country or region for which you want to set up scene information. It can consist of a string or an array. If the local area is an array, then the setlocale () function attempts each array element until it obtains valid language and region code information from it. This parameter is useful if a region is under different names in different operating systems. struct Lconv *localeconv (void);  usage localeconv return LCONV structure pointer lconv structure Description: Save formatted numeric information, save numeric values including currency and non-monetary formatting information, Localeconv returns a pointer to the object, which is the member and information in the structure: char *decimal_point;  digit decimal number char *thousands_sep;  number of thousand grouping separator Each element is the number of digits in the corresponding group, and the higher the index, the more the element is left. An element with a value of char_max means that there are no more groupings. An element with a value of 0 means that the preceding element can be used in all groups on the left to use the currency symbol specified in the three characters in ISO 4217 in the *int_curr_symbol;  preceding the Char *grouping;  digit grouping separator char. The fourth character is the delimiter, and the fifth character is ' the '/char *currency_symbol;  the local currency symbol char *mon_decimal_point;  currency's decimal number char *mon_thousands_ sep;  thousand group separator char *mon_grouping;  similar to grouping element char *positive_sign;  positive value of the symbol CHAR *negative_sign;  negative value symbol char int_frac_digits;  the decimal part of the international value char frac_digits;  the decimal part of the local currency value char P_cs_ precedes;  if the Currency_symbol is 1 before the positive value, or 0 char p_sep_by_space;  if and only if the Currency_symbol is separated from the positive value by a space of 1 char N _cs_precedes; < if Currency_symbol is 1 before negative value, it is 0/dt> char n_sep_by_space;  if and only if Currency_ Symbol and negative value separated by a space for 1 Char p_sign_posn;  format option 0-parentheses around the number and currency symbol  
1-the + number before the number and currency symbol
2-the + number after the number and currency symbol
3-the + number before the currency symbol
4-Currency symbol after the + number char n_sign_posn format option 0-parentheses around the number and currency symbol
1-Number before the number and currency symbol
2-numbers after the number and currency symbol
3-Number before currency symbol
4-After the currency symbol last hint: You can use the setlocale (lc_all,null) function to set the scene information to the system default value. <math.h> Mathematical Functions<math.h> is a library of mathematical functions in C trigonometry double sin (double x); Sine double cos (double x); Cosine double tan (double x); Tangent *cot trigonometric functions, which can be implemented using tan (pi/2-x).
Inverse Trigonometric Functions Double asin (double x); results are between [-PI/2, PI/2]
Double ACOs (double x); Results between [0, PI]
Double Atan (double x);
Tangent (primary value), the result is between [-PI/2, PI/2]
Double atan2 (double y,double);
Tangent (integer circle value), the result is between [-pi, PI]
Hyperbolic trigonometric functions double sinh (double x); Computes a hyperbolic sine double cosh (double x); Calculates the hyperbolic cosine double tanh (double x); Compute hyperbolic tangent
Exponent with logarithmic double exp (double x); The Power double sqrt (double x) of the natural number e is obtained; Square Double Log open (double x); Logarithmic double log10 (double x) with e as base; Logarithmic double pow (double x, double y) with a base of 10;
Calculates the Y-power with X as the base
float POWF (float x, float y);
Consistent with POW, both input and output are floating-point numbers
Take a whole double ceil (double); Take the whole double floor (double); Remove the whole
Standardize floating point numbers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.