C language "include" means: the header file is the "standard library" standard library header file. This file contains the definition of the C language standard library function "stdlib"; it contains the most commonly used system functions of C and C languages.
##The meaning of "include" in C language is: the header file is the standard library standard library header file. The file contains the definition of the C language standard library function stdlib, which contains the most commonly used system functions of C and C language.
stdlib.h defines five types, some macros and general 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.;
Commonly used functions such as malloc(), calloc(), realloc(), free(), system(), atoi(), atol(), rand(), srand(), exit(), etc. You can view the specific content by opening the stdlib.h header file in the include directory of the compiler.
stdlib.h usage
1 Function name: calloc
Function prototype:
void * calloc(unsigned n,unsign size);
Copy after login
Function Function: Allocate memory continuous space for n data items. The size of each data item is size
The function returns: The starting address of the allocated memory unit. If unsuccessful, returns 0
2 Function name: free
Function prototype:
void free(void* p);
Copy after login
Function function: Release the memory area pointed to by p
Function return:
Parameter description: p-released pointer
3 Function name: malloc
Function prototype:
void * malloc(unsigned size);
Copy after login
Function: allocate size bytes The storage area
function returns: the allocated memory area address, if the memory is not enough, returns 0
4 Function name: realloc
Function prototype :
void * realloc(void * p,unsigned size);
Copy after login
Function function: Change the size of the allocated memory area pointed by p to size, size can be larger or smaller than the original allocated space
Function return: Return points to the memory area Pointer.NULL-allocation failed
5 Function name: rand
Function prototype:
int rand(void);
Copy after login
Function function: Generate a random number between 0 and 32767 Integer (between 0 and 0x7fff)
Function returns: random integer
Extended information:
A function refers to a program that is put together to do something. Also called subroutine and (in OOP) method.
A larger program should generally be divided into several program blocks, and each module is used to implement a specific function. All high-level languages have the concept of subprograms, which are used to implement the functions of modules.
In C language, the function of a subroutine is composed of a main function and several functions. The main function calls other functions, and other functions can also call each other. The same function can be called any number of times by one or more functions.
In programming, some commonly used functional modules are often written into functions and placed in function libraries for public selection. Be good at using functions to reduce the workload of repeatedly writing program segments.
Functions are divided into global functions and global static functions; constructors, destructors, copy constructors, member functions, friend functions, operator overloaded functions, inline functions, etc. can also be defined in the class.
Recommended tutorial: "
C Language Tutorial"
The above is the detailed content of What does include in c language mean?. For more information, please follow other related articles on the PHP Chinese website!