One of C standard library study notes

Source: Internet
Author: User
Tags natural logarithm uppercase character

I bought the book "C standard library" during the summer vacation, but I did not study it carefully because I was studying GRE in New Oriental. At the beginning of the new semester, I had no time to take care of it because I learned SL. I just looked at it every other time. Recently, C language ranked first in the rankings, showing its importance in the programming world. Therefore, I decided to take some time to sort out my previous study notes. One is to help myself and the viewer review later, and the other is to witness some progress.

The first part is to sort out the content you read during the summer vacation, and summarize the header files and their members. The second part focuses on several common header files and their internal implementations. The third part is to test the knowledge through several small instances.

Overview of header files (I)

I. Assert. h
1. Void assert (INT expression );
No return value. If the expression is false, the call is interrupted.
Ii. ctype. h
1. Int isalnum (int c );
Check whether the specified character is a number or letter
2. Int isalpha (int c );
Check whether the specified character is a letter
3. Int iscntrl (int c );
Check whether the specified character is a page break, line break, carriage return, horizontal tab, vertical tab, escape, or alarm.
4. Int isdigit (int c );
Determines whether the specified character is a number.
5. Int isgraph (int c );
Determines whether the specified character is a print character other than space.
6. Int islower (int c );
Determines whether the specified character is lowercase.
7. Int isprint (int c );
Determines whether the specified character is a printable character including "".
8. Int isspace (int c );
Determines whether the specified character is a newline, linefeed, carriage return, horizontal tab, vertical tab, or space.
9. isupper (int c );
Determines whether the specified character is an uppercase character.
10. Int isxdigit (int c );
Configurable region settings, which are the same as isdigit by default.
11. Int tolower (int c );
Converts a specified character to lowercase.
12. Int toupper (int c );
Converts a specified character to uppercase or lowercase.
Iii. errno. h
Macro
Iv. Float. h
Macro part, test Overflow
5. Limits. h
Macro
Vi. locale. h
Two functions, one type (struct lconv), and some macros.
1. char * setlocale (INT category, const char * locale );
2. struct lconv * localeconv (void );
VII. Math. h
Trigonometric function:
1. Double ACOs (Double X );
Returns the arc cosine of X. If X is not in [-1, + 1], an error is thrown. The return value range is [0, Pi].
2. Double asin (Double X );
Calculate the triangle arcsin of X. If X is not in [-1, + 1], an error is thrown. The return value range is [-PI/2, PI/2].
3. Double atan (Double X );
Calculate the arc tangent of X. The return value range is [-PI/2, PI/2].
4. Double atan2 (Double Y, double X );
Calculate the main value of the triangle arc tangent function of Y/X. If both parameters are 0, an error is returned. The return value range is [-Pi, Pi].
5. Double cos (Double X );
Returns the cosine of X (in radians.
6. double sin (Double X );
Returns the sine of X (in radians.
7. Double Tan (Double X );
Returns the tangent of X (in radians.
8. Double cosh (Double X );
Returns the hyperbolic sine of X. If the value of X is too large, an error is returned.
9. Double sinh (Double X );
Returns the hyperbolic sine of X. If the value of X is too large, an error is returned.
10. Double Tanh (Double X );
Returns the hyperbolic tangent of X.
11. Double exp (Double X );
Calculate the exponential function of X.
12. Double frexp (double value, int * exp );
Divide a floating point number into a decimal number and a positive power of 2 (the product of both). The integer part exists in exp, And the decimal part is returned.
13. Double ldexp (Double X, int exp );
Calculate the x * 2 ^ exp value and return it.
14. Double Log (Double X );
Calculate the natural logarithm of X. If the parameter is negative, a value field error occurs.
15. Double log10 (Double X );
Calculates the base-10 logarithm of X.
16. Double MODF (double value, double * iptr );
Pass the integer part of value to iptr and return the fractional part.
Power function:
1. Double POW (Double X, Double Y );
Function compute X's Power Y to prevent value range errors.
2. Double SQRT (Double X );
Function compute is the non-negative square root of X. If the parameter is negative, an error occurs.
Integer, absolute value, and modulus:
1. Double Ceil (Double X );
Returns the smallest integer not less than X. Greater and rounded up.
2. Double FABS (Double X );
Returns the absolute value of X.
3. Double floor (Double X );
Returns the maximum integer not greater than X. Small and rounded up.
4. Double fmod (Double X, Double Y );
Returns the remainder of x/y.
8. setjmp. h
Defines a type of jmp_buf that saves the macro int setjmp (jmp_buf env) of the call environment, and restores the call environment function void longjmp (jmp_buf ENV, int Val );
The purpose is beyond the conventional function call and return rules.
9. Signal. h
Synchronous signals (generally program exceptions) and asynchronous Signal Processing (signals transmitted by external behavior ).
A type sig_atomic_t is defined, and two functions and some macros are defined:
Void (* signal (INT Sig, void (* func) (INT );
You can set three methods for signal processing.
Int raise (INT sig );
Send the signal sig to the running program. 0 is returned. Otherwise, the value is not 0.
10. stdarg. h
Variable Parameter List. Defines a type va_list.
MACRO:
1. Void va_start (va_list AP, paramn );
Initialize the AP.
2. Type va_arg (va_list AP, type );
3. Void va_end (va_list AP );
11. stddef. H is placed in stdlib. h.
Some types are defined:
Ptrdiff_t the signed integer type that the two pointers subtract
The unsigned integer type of the result of size_t using the sizeof Operator
Wchar_t Integer type
MACRO:
Null expansion is a null pointer constant defined by the implementation.
Offsetof (type, member_designator) is expanded into a size_t type that specifies the starting position of the structure and member_designator that specifies the cheap amount.

To be continued ......

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.