C Language-summary of commonly used built-in functions

Source: Internet
Author: User
Tags base 10 logarithm natural logarithm square root

Ctype.h
1.isalpha (): Tests whether a character is a letter, or returns 1, otherwise returns 0.
2.isdigit (): Tests whether a character is a number, or returns 1, otherwise returns 0.
3.isupper (): Tests whether a character is uppercase.
4.islower (): Tests whether a character is a lowercase letter.
5.toupper (): The lowercase letter is converted to uppercase and returned.
6.tolower (): Turns uppercase letters into lowercase letters and returns.


String.h
1.strcpy (): Copies the contents of a string into a character array.
2.strlen (): Calculates the length of a string in a character array. Does not include NULL 0
3.strcat (): Merges a two-character array.

Stdio.h
1.puts (): Outputs a string. The default is to add a line break at the end.
Example: Puts ("www.baidu.com");
puts (table); Talbe is a character array
2.gets (): Gets a string that ends with enter.
3.fopen (): Gets a file entry address
4.fclose (): Closes a file.
5.fprintf (): Enter string information into the file.
6.fgets (): reads a row of data.
7.fputs (): Output data to file.
8.feof (): Detects whether the end of the file is reached.
9.fseek (): Random Access file

Math.h
1.ceil (): Rounding up, return value is floating point
2.floor (): Rounding down, return value is floating point
3.fabs (): Returns the floating point absolute value
4.cos (x): Returns the cosine of the angle X
5.sin (x): Returns the sinusoidal value of the angle X
6.tan (x): Returns the tangent of the angle X
7.pow (): Calculates the power of a value
8.SQRT (): Returns the square root of a value
9.exp (x): Returns the value of E^x
10.log (x): Returns the natural logarithm of x, which is mathematically written in ln (x).
11.LOG10 (x): Returns the base 10 logarithm.

Stdlib.h
1.rand (): Randomly generates a value from 0 to 32767. If Rand () is not set to generate a random number of seeds, then it always generates the same random number.
2.srand (): Sets the random number generation seed.

An example of a positive and true random number:
#include <stdlib.h>
#include <math.h>

#define NUM_CARDS54

time_t T;
Srand (Time (&t));
Sub_draw = (rand ()% (num_cards));
3.malloc (): Allocating heap memory
Cases:
int *temps;
temps = (int *) malloc (10*sizeof (int));

4.free (): Free heap Memory

C Language-summary of commonly used built-in functions

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.