AVR Libc Home Page | AVR Libc Development Pages | |||
Main Page | FAQ | Library Reference | Additional Documentation | Example Projects |
#include <stdlib.h>
This file declares some basic C macros and functions as defined by the ISO standard, plus some AVR-specific extensions.
Data Structures | |
struct | div_t |
struct | ldiv_t |
Non-standard (i.e. non-ISO C) functions. | |
#define | RANDOM_MAX 0x7FFFFFFF |
char * | ltoa (long int __val, char *__s, int __radix) |
char * | utoa (unsigned int __val, char *__s, int __radix) |
char * | ultoa (unsigned long int __val, char *__s, int __radix) |
long | random (void) |
void | srandom (unsigned long __seed) |
long | random_r (unsigned long *ctx) |
char * | itoa (int __val, char *__s, int __radix) |
Defines | |
#define | RAND_MAX 0x7FFF |
Typedefs | |
typedef int(* | __compar_fn_t )(const void *, const void *) |
Functions | |
__inline__ void | abort (void) __ATTR_NORETURN__ |
int | abs (int __i) __ATTR_CONST__ |
long | labs (long __i) __ATTR_CONST__ |
void * | bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, int(*__compar)(const void *, const void *)) |
div_t | div (int __num, int __denom) __asm__("__divmodhi4") __ATTR_CONST__ |
ldiv_t | ldiv (long __num, long __denom) __asm__("__divmodsi4") __ATTR_CONST__ |
void | qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) |
long | strtol (const char *__nptr, char **__endptr, int __base) |
unsigned long | strtoul (const char *__nptr, char **__endptr, int __base) |
__inline__ long | atol (const char *__nptr) __ATTR_PURE__ |
__inline__ int | atoi (const char *__nptr) __ATTR_PURE__ |
void | exit (int __status) __ATTR_NORETURN__ |
void * | malloc (size_t __size) __ATTR_MALLOC__ |
void | free (void *__ptr) |
void * | calloc (size_t __nele, size_t __size) __ATTR_MALLOC__ |
void * | realloc (void *__ptr, size_t __size) __ATTR_MALLOC__ |
double | strtod (const char *__nptr, char **__endptr) |
double | atof (const char *__nptr) |
int | rand (void) |
void | srand (unsigned int __seed) |
int | rand_r (unsigned long *ctx) |
Variables | |
size_t | __malloc_margin |
char * | __malloc_heap_start |
char * | __malloc_heap_end |
|
Highest number that can be generated by rand(). |
|
Highest number that can be generated by random(). |
|
Comparision function type for qsort(), just for convenience. |
|
The abort() function causes abnormal program termination to occur. In the limited AVR environment, execution is effectively halted by entering an infinite loop. |
|
The abs() function computes the absolute value of the integer |
|
The atof() function converts the initial portion of the string pointed to by It is equivalent to calling
strtod(nptr, (char **)NULL); |
|
Convert a string to an integer.
The atoi() function converts the initial portion of the string pointed to by It is equivalent to:
(int)strtol(nptr, (char **)NULL, 10); |
|
Convert a string to a long integer.
The atol() function converts the initial portion of the string pointed to by It is equivalent to:
strtol(nptr, (char **)NULL, 10); |
|
The bsearch() function searches an array of
The contents of the array should be in ascending sorted order according to the comparison function referenced by The bsearch() function returns a pointer to a matching member of the array, or a null pointer if no match is found. If two members compare as equal, which member is matched is unspecified. |
|
Allocate |
|
The div() function computes the value |
|
The exit() function terminates the application. Since there is no environment to return to, In a C++ context, global destructors will be called before halting execution. |
|
The free() function causes the allocated memory referenced by |
|
Convert an integer to a string.
The function itoa() converts the integer value from
radix as base, which may be a number between 2 (binary conversion) and up to 36. If radix is greater than 10, the next digit after '9' will be the letter 'a' .If radix is 10 and val is negative, a minus sign will be prepended.
The itoa() function returns the pointer passed as |
|
The labs() function computes the absolute value of the long integer |
|
The ldiv() function computes the value |
|
Convert a long integer to a string.
The function ltoa() converts the long integer value from
radix as base, which may be a number between 2 (binary conversion) and up to 36. If radix is greater than 10, the next digit after '9' will be the letter 'a' .If radix is 10 and val is negative, a minus sign will be prepended.
The ltoa() function returns the pointer passed as |
|
The malloc() function allocates Note that malloc() does not initialize the returned memory to zero bytes. See the chapter about malloc() usage for implementation details. |
|
The qsort() function is a modified partition-exchange sort, or quicksort.
The qsort() function sorts an array of The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. |
|
The rand() function computes a sequence of pseudo-random integers in the range of 0 to
The srand() function sets its argument If no seed value is provided, the functions are automatically seeded with a value of 1.
In compliance with the C standard, these functions operate on |
|
Variant of rand() that stores the context in the user-supplied variable located at |
|
The random() function computes a sequence of pseudo-random integers in the range of 0 to
The srandom() function sets its argument If no seed value is provided, the functions are automatically seeded with a value of 1. |
|
Variant of random() that stores the context in the user-supplied variable located at |
|
The realloc() function tries to change the size of the region allocated at The contents of the returned region up to either the old or the new size value (whatever is less) will be identical to the contents of the old region, even in case a new region had to be allocated.
It is acceptable to pass
If the new memory cannot be allocated, realloc() returns NULL, and the region at |
|
Pseudo-random number generator seeding; see rand(). |
|
Pseudo-random number generator seeding; see random(). |
|
The strtod() function converts the initial portion of the string pointed to by
The expected form of the string is an optional plus ( Leading white-space characters in the string are skipped. The strtod() function returns the converted value, if any.
If
If no conversion is performed, zero is returned and the value of
If the correct value would cause overflow, plus or minus FIXME: HUGE_VAL needs to be defined somewhere. The bit pattern is 0x7fffffff, but what number would this be? |
|
The strtol() function converts the string in
The string may begin with an arbitrary amount of white space (as determined by isspace()) followed by a single optional
The remainder of the string is converted to a long value in the obvious manner, stopping at the first character which is not a valid digit in the given base. (In bases above 10, the letter
If
The strtol() function returns the result of the conversion, unless the value would underflow or overflow. If no conversion could be performed, 0 is returned. If an overflow or underflow occurs, |
|
The strtoul() function converts the string in
The string may begin with an arbitrary amount of white space (as determined by isspace()) followed by a single optional
The remainder of the string is converted to an unsigned long value in the obvious manner, stopping at the first character which is not a valid digit in the given base. (In bases above 10, the letter
If
The strtoul() function return either the result of the conversion or, if there was a leading minus sign, the negation of the result of the conversion, unless the original (non-negated) value would overflow; in the latter case, strtoul() returns ULONG_MAX, and |
|
Convert an unsigned long integer to a string.
The function ultoa() converts the unsigned long integer value from
radix as base, which may be a number between 2 (binary conversion) and up to 36. If radix is greater than 10, the next digit after '9' will be the letter 'a' .
The ultoa() function returns the pointer passed as |
|
Convert an unsigned integer to a string.
The function utoa() converts the unsigned integer value from
radix as base, which may be a number between 2 (binary conversion) and up to 36. If radix is greater than 10, the next digit after '9' will be the letter 'a' .
The utoa() function returns the pointer passed as |
|
|
|