learnprogramming123

LEARN PROGRAMMING 123
your resources to programming and free tutition



Navigation

 
C
 
C++ soon here!
VB - soon here!

Search

 

 

Next Back

 

<stdlib.h>        -        General Utilities

The header provides functions for converting numbers to strins and strings to numbers, random number generation, memory managment, searching, sorting, operations upon multi-byte charactrs and strings, and miscellanous functions.

void abort(void); writes the message "Abnormal Program Termination" to stdder and calls raise(SIGABRT)
int abs(int num); returns the absolute num
int atexit(void (*frnct)(void)); places the function pointer func onto a stack to be called from the function exit when the process terminates, returns 0 if the function was successfully placed on the stack
double atof(const char *s); converts the string argument to double precision, returns the result of the conversion
int atol(const char *s); converts the string input s to an integer value, returns the result of the conversion
void *bsearch(const void *key,
const void *base,
sizt_t num,
size_t width,
int (*compare)(const void *e1, const void *e2));
performs a binary search on a sorted array
void *calloc (size_t number, size_t size); returns a pointer to the allocated storage, otherwise returns NULL to indicate insufficient storage
div_t div(int num, int den); divides num by den, returning the quotient in the dv_t structure member quot and the remainder in the structure member rem
void exit(int status); terminates the calling process
char *getenv(const char *name); returns a pointer to the environment variable containing the string value of name, if the variable is not defined the return value will be NULL
long labs(long num); returns the absolute value of its long integer argument num
struct 1divt 1div(long num, long den); divides num by den, storing the quotient in the structure member quot and the remainder in the structure rem, returns a structure of type 1div_t which contains members for quotient and remainder
void *malloc(size_t size); allocates a block of at least size bytes from the heap, returns a void pointer to the allocated space, otherwise returns NULL
int mblen(const char *s, size_t n); determines the number of bytes comprising the multi-byte character to which s points
size_t mbstowcs(wchar_t *pwes, const char *s, size_t n); converts a sequence of multi-byte characters pointed to b s and stores them as codes at the addresses to which pwcs points, returns the number of characters copied
int mbtowc(wchar_t *pwc, const char *s, size_t n); converts up to n bytes comprising the multi-byte character pointed to by s to a code representing that character and stores this code at pwc, provided that pwc is not NULL
void qsort(const void *base,
size_t num,
size_t width,
int(*compare)(const void *e1, const void *e2));
qsort is an implementation of the quick sort algorithm for sorting an array
int rand(void); returns a pseudo-rand
void *realloc(void *buffer, size_t size); changes the size of a memory block (buffer) previously allocated from the heap by a call to calloc, malloc or reallocm size is the new number of bytes requested, returns a void pointer to the allocated space
void srand(unsigned seed); sets the starting point for the pseudo random number generator
double strtod(const char *s, char **endptr); converts a string to a double precision floating point value
long strtol(const char *s, char **endptr, int base); converts a string to a long integer value
unsigned long strtoul(const chr *s, char **endptr, int base); converts a string to an unsigned long integer value
size_t wcstombs(char *s, const wchar_t *pwcs, size_t n); converts the codes stored at the location to which pwcs points, these codes are converted to multi-byte characters and stored at the location to which s points, returns the number of characters created
int wctomb(const char *, wchar_t wchar); returns the number of bytes needed to represent the code wchar as a multi-byte character and stores the multi-byte character at s
   

 

go to <string.h>     back to top        back to main