The role of C-Language header file #include<stdlib.h>

Source: Internet
Author: User

Stdlib header file is standard library header file Stdlib header file contains the C, C + + language of the most commonly usedsystem FunctionsThe file contains the C language standardLibrary FunctionsThe definition

The stdlib.h defines five types, some macros, and common tool functions. Types such as size_t, wchar_t, div_t, ldiv_t, and lldiv_t; macros such as Exit_failure, Exit_success,Rand_max , and Mb_cur_max, etc. Common functions such as malloc (), Calloc (), realloc (), free (), System (), Atoi (), ATOL (), Rand (), Srand (), exit (), and so on. Specific content you can open the compiler 's include directory inside the stdlib.h header file to see.

Stdlib.h usage 1 Function name: calloc

Function prototype: void * CALLOC (unsigned n,unsign size);

function function: Allocates memory contiguous space of n data items, size of each data item

function return: Allocates the starting address of the memory unit, if unsuccessful, returns 0

2 Function Name: free

Function prototype: void free (void* p);

function function: Release the memory area referred to by P

function returns:

Parameter description: P-Released pointer

3 Function Name: malloc

Function prototype: void * malloc (unsigned size);

function function: Allocate a size byte storage area

function returns: The allocated memory area address, if memory is insufficient, returns 0

4 Function Name: realloc

Function prototype: void * realloc (void * p,unsigned size);

function function: Change the size of allocated memory area indicated by P to size,size can be larger or smaller than the original allocated space

function returns: Returns a pointer to the memory area. null-Allocation failure

5 Function Name: Rand

Function prototype: int rand (void);

function function: Generates random integers between 0 and 32767 (0 to 0X7FFF)

function return: Random integer

6 Function Name: Abort

Function prototype: void abort (void)

function function: Terminates a process abnormally.

7 Function Name: Exit

Function prototype: void exit (int state)

function function: Program abort execution, return call procedure

function returns:

Parameter description: state:0-normal Abort, non 0-abnormal abort

8 Function Name: getenv

Function prototypes: char* getenv (const char *name)

function function: Returns a pointer to an environment variable

function return: definition of environment variable

Parameter description: name-environment string

9 Function Name: putenv

function prototypes: int putenv (const char *name)

function function: Adds the string name to the DOS environment variable

function return: 0: Operation succeeded,-1: Operation failed

Parameter description: name-environment string

10 Function Name: Labs

Function prototypes: Long Labs (Long num)

function function: To find the absolute value of long integer parameters

function return: Absolute value

11 Function Name: atof

Function prototype: Double atof (char *str)

function function: Converts a string into a double-precision value

function return: Converted Value

Parameter description: str-string to convert floating-point number

12 Function Name: atoi

function prototypes: int atoi (char *str)

function function: Converts a string into an integer value

function return: Converted Value

Parameter description: str-string to be converted to an integral number

13 Function Name: ATOL

Function prototype: Long Atol (char *str)

function function: Converts a string into a long integer

function return: Converted Value

Parameter description: str-string to be converted to a long integer

14 Function Name: ECVT

Function prototypes: Char *ecvt (double value,int ndigit,int *dec,int *sign)

function functions: Converting floating-point numbers to strings

function return: converted string pointer

Parameter description: value-the bottom floating-point number to be converted, ndigit-the converted string length

15 Function Name: FCVT

Function prototypes: Char *fcvt (double value,int ndigit,int *dec,int *sign)

function function: Change floating point number to a string

function return: string pointer after conversion

Parameter description: value-the bottom floating-point number to be converted, ndigit-the bottom string length after conversion

The role of C-Language header file #include<stdlib.h>

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.