stdlib.h in C
stdlib.h in C
The header file named stdlib.h in Standard C Library defines four variable types, a number of macros and various functions to implement common features.
The variables are defined in stdlib.h
The following lists some types of variables defined in stdlib.h:
Description variable size_tThis is an unsigned integer type and the result of the sizeof keyword
wchar_tThis is an integer type whose size is a constant wide char
div_tThis is the structure returned by the div function
ldiv_tThis is the structure returned by the ldiv function
The macros are defined in stdlib.h
The table below lists some macros defined in stdlib.h:
Macro Description NULLThis macro is the value of a null pointer constant
EXIT_FAILUREThis is the value for exit function to return in case of failure
EXIT_SUCCESSThis is the value for exit function to return in case of success
RAND_MAXThis macro is the maximum value returned by the rand function
MB_CUR_MAXThis macro is the maximum number of bytes in a multi-byte character set that cannot be larger than MB_LEN_MAX
Functions are defined in stdlib.h
Here are some functions defined in stdio.h:
STD & Description1Double atof function (const char * str)
Convert a string pointed to by parameter str to a floating point number (type double)
2Int atoi function (const char * str)
Convert a string pointed to by parameter str to an integer (type int)
3Function long int atol (const char * str)
Convert a string pointed to by parameter str to some long int
4Function double strtod (const char * str, char ** endptr)
Convert a string pointed to by parameter str to a floating point number (type double)
5Function long int strtol (const char * str, char ** endptr, int base)
Convert a string pointed to by parameter str to some long int
6Function unsigned long int strtoul (const char * str, char ** endptr, int base)
Converts a string pointed to by parameter str to an unsigned number long int
7Function void * calloc (size_t nitems, size_t size)
Memory allocation is required and returns a pointer to it
8Void free function (void * ptr
Free the previously allocated memory by a call to calloc, malloc, or realloc
9Function void * malloc (size_t size)
Memory allocation is required and returns a pointer to it
tenVoid * realloc function (void * ptr, size_t size)
Attempt to recover the memory block pointed to by str that was previously allocated with a call to malloc or calloc
11Void abort function (void)
Causing an abnormal program end
twelfthInt atexit function (void (* func) (void))
Make the func function given to be called when the program ends in the usual way
13Function void exit (int status)
Make the program end normally
14Char * getenv function (const char * name)
Search for the environment string pointed to by name and return the value associated with that string
15Function int system (const char * string)
The command specified by the string is passed to the host environment to be executed by the Command Processor
16Void function * bsearch (const void * key, const void * base, size_t nitems, size_t size, int (* compar) (const void *, const void *))
Make a Binary Search
17Void qsort function (void * base, size_t nitems, size_t size, int (* compar) (const void *, const void *))
Arrange an array
18Int abs function (int x)
Returns the absolute value of x
19Div_t div function (int numer, int denom)
Divide the numerator numer to the demon number
20Function long int labs (long int x)
Returns the absolute value of x
21Ldiv_t ldiv function (long int numer, long int denom)
Divide the numerator numer to the demon number
22Function int rand (void)
Returns a random number in the range of values from 0 to RAND_MAX
23Function void srand (unsigned int seed)
This function provides seed for the random number generator used by the rand function
24Function int mblen (const char * str, size_t n)
Returns the length of a multi-byte char pointed to by parameter str
25Function size_t mbstowcs (schar_t * pwcs, const char * str, size_t n)
Convert the string of multi-byte char points pointed to by the parameter str to the array pointed to by pwcs
26Function int mbtowc (whcar_t * pwc, const char * str, size_t n)
Convert a multi-byte sequence into a wide char
27Function size_t wcstombs (char * str, const wchar_t * pwcs, size_t n)
Convert the code stored in the pwcs array into multi-byte char and store them in the string str
28Int wctomb function (char * str, wchar_t wchar)
Convert its wide char to a multi-byte char representation and store it at the beginning of the character array pointed to by str
According to Tutorialspoint
Previous lesson: Function of perror () in C
Next lesson: Atof () function in C
You should read it
May be interested
- Check out the 'buffalo' Pokémon in Pokémon Goeach type of pokemon has hp, cp, ability to attack and endure differently. based on these indicators, players can determine as well as choosing the most powerful pokemon for their offensive tactics.
- Sitting home can also locate Pokemon around, do you believe it?the tightening of the niantic developers' rules to prevent players from abusing the support tools also brings annoyance, such as those who have no conditions to move much, go away, it is hard to know. get the location of the pokemon around the area they live in
- 5 undeniable benefits when playing Pokemon Goget to know many new people, breathe fresh air, relieve stress, increase concentration thanks to going out for a walk .... are compelling reasons to force you to try pokemon go now .
- Want to earn the fastest Pokécoins in Pokémon Go? So don't miss this article!pokécoins in pokémon go play the role of buying items in the store. the more coins you earn, the more likely you are to buy more items. to earn pokécoins, players will have to complete certain tasks or buy real money.
- Pokémon systems when fighting in Pokémon Goeach pokémon system in pokémon go has different strengths, along with a specific weakness. this type of pokémon will have the power to attack the other pokémon, but can defeat the other pokémon. if you know the characteristics of each type, it will be easier to choose which pokémon to battle.
- The terms you need to know when playing Pokémon Gopokémon go is the most prominent name in recent days. this game of capturing and training virtual animals has created a relatively new way of playing, as players have to constantly move to catch pokémon. during the process of joining pokémon go, you will encounter and use a lot of important terms. so what do they mean?
- How to play Pokemon GO on Windows computersrecently, pokemon go has become a popular game, attracting thousands of gamers around the world. in previous posts network administrator has guided you on how to play pokemon go on android devices and ios devices. in the article below, network administrator will guide you how to play pokemon go on windows computers using bluestacks emulator software.
- How to become a good Pokémon Go hunter?with a new way of playing, pokémon go has created a new phenomenon in the game village around the world. players will have to go around and find pokémon for themselves. so how to quickly catch pokémon and in large numbers?
- Things to know to upgrade Pokémon in Pokémon Gothe whirlwind pokémon go has spread its power right on the first day of its release. everyone rushed to the street to find a pokémon for themselves. therefore, in order to become a pokémon hunter, you need to master the basics of participating in pokémon go battlefield.
- List of medals received in Pokemon Goin addition to getting items when leveling up, gamers who join pokemon go also have the opportunity to receive their proud achievements.