Programming in C

(Barry) #1
490 Appendix B The Standard C Library

double complex ctan (z)
Returns the complex tangent of z.
double complex ctanh (z)
Returns the complex hyperbolic tangent of z.

General Utility Functions

Some routines from the library don’t fit neatly into any of the previous categories.To use
these routines, include the header file <stdlib.h>.
int abs (n)
Returns the absolute value of its intargument n.
void exit (n)
Te r minates program execution, closing any open files and returning the exit status
specified by its intargument n.EXIT_SUCCESSand EXIT_FAILURE, defined in
<stdlib.h>, can be used to return a success or failure exit status, respectively.
Other related routines in the library that you might want to refer to are abortand
atexit.
char *getenv (s)
Returns a pointer to the value of the environment variable pointed to by s, or a null
pointer if the variable doesn’t exist.This function operates in a system-dependent way.
As an example, under Unix, the code
char *homedir;
...
homedir = getenv ("HOME");
could be used to get the value of the user’s HOMEvariable, storing a pointer to it inside
homedir.
long int labs (l)
Returns the absolute value of its long intargument l.
long long int llabs (ll)
Returns the absolute value of its long long intargument ll.
void qsort (arr, n, size, comp_fn)
Sorts the data array pointed to by the voidpointer arr.There are nelements in the
array, each sizebytes in length.nand sizeare of type size_t.The fourth argument
is of type “pointer to function that returns intand that takes two voidpointers as

21 0672326663 AppB 6/10/04 2:03 PM Page 490

Free download pdf