Make your own free website on
'; zhtm += ''; zhtm += '

' + pPage + ''; zhtm += ''; window.popUpWin.document.write(zhtm); window.popUpWin.document.close(); // Johnny Jackson 4/28/98 } //--> Teach Yourself C in 21 Days -- Appendix E -- Common C Functions

Previous chapterNext chapterContents

- E -

Common C Functions

This appendix lists the function prototypes contained in each of the header files supplied with most C compilers. Functions that have an asterisk after them were covered in this book.

The functions are listed alphabetically. Following each name and header file is the complete prototype. Notice that the header file prototypes use a notation different from that used in this book. For each parameter a function takes, only the type is given in the prototype; no parameter name is included. Here are two examples:

int func1(int, int *);
int func1(int x, int *y);

Both declarations specify two parameters--the first a type int, and the second a pointer to type int. As far as the compiler is concerned, these two declarations are equivalent.

Table E.1. Common C functions listed in alphabetical order.

Function Header File Function Prototype
abort* STDLIB.H void abort(void);
abs STDLIB.H int abs(int);
acos* MATH.H double acos(double);
asctime* TIME.H char *asctime(const struct tm *);
asin* MATH.H double asin(double);
assert* ASSERT.H void assert(int);
atan* MATH.H double atan(double);
atan2* MATH.H double atan2(double, double);
atexit* STDLIB.H int atexit(void (*)(void));
atof* STDLIB.H double atof(const char *);
atof* MATH.H double atof(const char *);
atoi* STDLIB.H int atoi(const char *);
atol* STDLIB.H long atol(const char *);
bsearch* STDLIB.H void *bsearch(const void *, const void *, size_t, size_t, int(*) (const void *, const void *));
calloc* STDLIB.H void *calloc(size_t, size_t);
ceil* MATH.H double ceil(double);
clearerr STDIO.H void clearerr(FILE *);
clock* TIME.H clock_t clock(void);
cos* MATH.H double cos(double);
cosh* MATH.H double cosh(double);
ctime* TIME.H char *ctime(const time_t *);
difftime TIME.H double difftime(time_t, time_t);
div STDLIB.H div_t div(int, int);
exit* STDLIB.H void exit(int);
exp* MATH.H double exp(double);
fabs* MATH.H double fabs(double);
fclose* STDIO.H int fclose(FILE *);
fcloseall* STDIO.H int fcloseall(void);
feof* STDIO.H int feof(FILE *);
fflush* STDIO.H int fflush(FILE *);
fgetc* STDIO.H int fgetc(FILE *);
fgetpos STDIO.H int fgetpos(FILE *, fpos_t *);
fgets* STDIO.H char *fgets(char *, int, FILE *);
floor* MATH.H double floor(double);
flushall* STDIO.H int flushall(void);
fmod* MATH.H double fmod(double, double);
fopen* STDIO.H FILE *fopen(const char *, const char *);
fprintf* STDIO.H int fprintf(FILE *, const char *, ...);
fputc* STDIO.H int fputc(int, FILE *);
fputs* STDIO.H int fputs(const char *, FILE *);
fread* STDIO.H size_t fread(void *, size_t, size_t, FILE *);
free* STDLIB.H void free(void *);
freopen STDIO.H FILE *freopen(const char *, const char *, FILE *);
frexp* MATH.H double frexp(double, int *);
fscanf* STDIO.H int fscanf(FILE *, const char *, ...);
fseek* STDIO.H int fseek(FILE *, long, int);
fsetpos STDIO.H int fsetpos(FILE *, const fpos_t *);
ftell* STDIO.H long ftell(FILE *);
fwrite* STDIO.H size_t fwrite(const void *, size_t, size_t, FILE *);
getc* STDIO.H int getc(FILE *);
getch* STDIO.H int getch(void);
getchar* STDIO.H int getchar(void);
getche* STDIO.H int getche(void);
getenv STDLIB.H char *getenv(const char *);
gets* STDIO.H char *gets(char *);
gmtime TIME.H struct tm *gmtime(const time_t *);
isalnum* CTYPE.H int isalnum(int);
isalpha* CTYPE.H int isalpha(int);
isascii* CTYPE.H int isascii(int);
iscntrl* CTYPE.H int iscntrl(int);
isdigit* CTYPE.H int isdigit(int);
isgraph* CTYPE.H int isgraph(int);
islower* CTYPE.H int islower(int);
isprint* CTYPE.H int isprint(int);
ispunct* CTYPE.H int ispunct(int);
isspace* CTYPE.H int isspace(int);
isupper* CTYPE.H int isupper(int);
isxdigit* CTYPE.H int isxdigit(int);
labs STDLIB.H long int labs(long int);
ldexp MATH.H double ldexp(double, int);
ldiv STDLIB.H ldiv_t div(long int, long int);
localtime* TIME.H struct tm *localtime(const time_t *);
log* MATH.H double log(double);
log10* MATH.H double log10(double);
malloc* STDLIB.H void *malloc(size_t);
mblen STDLIB.H int mblen(const char *, size_t);
mbstowcs STDLIB.H size_t mbstowcs(wchar_t *, const char *, size_t);
mbtowc STDLIB.H int mbtowc(wchar_t *, const char *, size_t);
memchr STRING.H void *memchr(const void *, int, size_t);
memcmp STRING.H int memcmp(const void *, const void *, size_t);
memcpy STRING.H void *memcpy(void *, const void *, size_t);
memmove STRING.H void *memmove(void *, const void*, size_t);
memset STRING.H void *memset(void *, int, size_t);
mktime* TIME.H time_t mktime(struct tm *);
modf MATH.H double modf(double, double *);
perror* STDIO.H void perror(const char *);
pow* MATH.H double pow(double, double);
printf* STDIO.H int printf(const char *, ...);
putc* STDIO.H int putc(int, FILE *);
putchar* STDIO.H int putchar(int);
puts* STDIO.H int puts(const char *);
qsort* STDLIB.H void qsort(void*, size_t, size_t, int (*)(const void*, const void *));
rand STDLIB.H int rand(void);
realloc* STDLIB.H void *realloc(void *, size_t);
remove* STDIO.H int remove(const char *);
rename* STDIO.H int rename(const char *, const char *);
rewind* STDIO.H void rewind(FILE *);
scanf* STDIO.H int scanf(const char *, ...);
setbuf STDIO.H void setbuf(FILE *, char *);
setvbuf STDIO.H int setvbuf(FILE *, char *, int, size_t);
sin* MATH.H double sin(double);
sinh* MATH.H double sinh(double);
sleep* TIME.H void sleep(time_t);
sprintf STDIO.H int sprintf(char *, const char *, ...);
sqrt* MATH.H double sqrt(double);
srand STDLIB.H void srand(unsigned);
sscanf STDIO.H int sscanf(const char *, const char *, ...);
strcat* STRING.H char *strcat(char *,const char *);
strchr* STRING.H char *strchr(const char *, int);
strcmp* STRING.H int strcmp(const char *, const char *);
strcmpl* STRING.H int strcmpl(const char *, const char *);
strcpy* STRING.H char *strcpy(char *, const char *);
strcspn* STRING.H size_t strcspn(const char *, const char *);
strdup* STRING.H char *strdup(const char *);
strerror STRING.H char *strerror(int);
strftime* TIME.H size_t strftime(char *, size_t, const char *, const struct tm *);
strlen* STRING.H size_t strlen(const char *);
strlwr* STRING.H char *strlwr(char *);
strncat* STRING.H char *strncat(char *, const char *, size_t);
strncmp* STRING.H int strncmp(const char *, const char *, size_t);
strncpy* STRING.H char *strncpy(char *, const char *, size_t);
strnset* STRING.H char *strnset(char *, int, size_t);
strpbrk* STRING.H char *strpbrk(const char *, const char *);
strrchr* STRING.H char *strrchr(const char *, int);
strspn* STRING.H size_t strspn(const char *, const char *);
strstr* STRING.H char *strstr(const char *, const char *);