0% found this document useful (0 votes)
60 views

Common C Functions

This document lists common C functions grouped by header file. It provides the function prototype for each function including the return type and parameters. Some key functions covered include printf, scanf, strcpy, malloc, free and more from header files like stdio.h, string.h, stdlib.h and others. The functions are listed alphabetically making it easy to find the prototype for a given function.

Uploaded by

Ziya Cuku
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Common C Functions

This document lists common C functions grouped by header file. It provides the function prototype for each function including the return type and parameters. Some key functions covered include printf, scanf, strcpy, malloc, free and more from header files like stdio.h, string.h, stdlib.h and others. The functions are listed alphabetically making it easy to find the prototype for a given function.

Uploaded by

Ziya Cuku
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Appendix 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 abort* abs acos* asctime* asin* assert* atan* atan2 * atexit* atof* atof* atoi* atol* bsearch* calloc* ceil* clearerr clock* cos* cosh* ctime* difftime div exit* exp* fabs* STDLIB.H STDLIB.H MATH.H TIME.H MATH.H Function Prototype void abort(void); int abs(int); double acos(double); char *asctime(const struct tm *); double asin(double);

ASSERT.H void assert(int); MATH.H double atan(double); MATH.H STDLIB.H STDLIB.H MATH.H STDLIB.H STDLIB.H STDLIB.H STDLIB.H MATH.H STDIO.H TIME.H MATH.H MATH.H TIME.H TIME.H STDLIB.H STDLIB.H MATH.H MATH.H double atan2(double, double); int atexit(void (*)(void)); double atof(const char *); double atof(const char *); int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int(*) (const void *, const void *)); void *calloc(size_t, size_t); double ceil(double); void clearerr(FILE *); clock_t clock(void); double cos(double); double cosh(double); char *ctime(const time_t *); double difftime(time_t, time_t); div_t div(int, int); void exit(int); double exp(double); double fabs(double); 422

fclose* fcloseall* feof* fflush* fgetc* fgetpos fgets* floor* flushall* fmod* fopen* fprintf* fputc* fputs* fread* free* freopen frexp * fscanf* fseek* fsetpos ftell* fwrite * getc* getch* getchar* getche * getenv gets* gmtime isalnum * isalpha * isascii* iscntrl* isdigit* isgraph* islower* isprint*

STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H MATH.H STDIO.H MATH.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDLIB.H STDIO.H MATH.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDLIB.H STDIO.H TIME.H CTYPE.H CTYPE.H CTYPE.H CTYPE.H CTYPE.H CTYPE.H CTYPE.H CTYPE.H

int fclose(FILE *); int fcloseall(void); int feof(FILE *); int fflush(FILE *); int fgetc(FILE *); int fgetpos(FILE *, fpos_t *); char *fgets(char *, int, FILE *); double floor(double); int flushall(void); double fmod(double, double); FILE *fopen(const char *, const char *); int fprintf(FILE *, const char *, ...); int fputc(int, FILE *); int fputs(const char *, FILE *); size_t fread(void *, size_t, size_t, FILE *); void free(void *); FILE *freopen(const char *, const char *, FILE *); double frexp(double, int *); int fscanf(FILE *, const char *, ...); int fseek(FILE *, long, int); int fsetpos(FILE *, const fpos_t *); long ftell(FILE *); size_t fwrite(const void *, size_t, size_t, FILE *); int getc(FILE *); int getch(void); int getchar(void); int getche(void); char *getenv(const char *); char *gets(char *); struct tm *gmtime(const time_t *); int isalnum(int); int isalpha(int); int isascii(int); int iscntrl(int); int isdigit(int); int isgraph(int); int islower(int); int isprint(int); 423

ispunct* isspace* isupper* isxdigit* labs ldexp ldiv

CTYPE.H CTYPE.H CTYPE.H CTYPE.H STDLIB.H MATH.H STDLIB.H

int ispunct(int); int isspace(int); int isupper(int); int isxdigit(int); long int labs(long int); double ldexp(double, int); ldiv_t div(long int, long int); struct tm *localtime(const time_t *); double log(double); double log10(double); void *malloc(size_t); int mblen(const char *, size_t); size_t mbstowcs(wchar_t *, const char *, size_t); int mbtowc(wchar_t *, const char *, size_t); void *memchr(const void *, int, size_t); int memcmp(const void *, const void *, size_t); void *memcpy(void *, const void *, size_t); void *memmove(void *, const void*, size_t); void *memset(void *, int, size_t); time_t mktime(struct tm *); double modf(double, double *); void perror(const char *); double pow(double, double); int printf(const char *, ...); int putc(int, FILE *); int putchar(int); int puts(const char *); void qsort(void*, size_t, size_t, int (*)(const void*, const void *)); int rand(void); void *realloc(void *, size_t); int remove(const char *); int rename(const char *, const char *); void rewind(FILE *); int scanf(const char *, ...); void setbuf(FILE *, char *); int setvbuf(FILE *, char *, int, size_t); double sin(double); double sinh(double); 424

localtime* TIME.H log* MATH.H log10* malloc* mblen MATH.H STDLIB.H STDLIB.H

mbstowcs STDLIB.H mbtowc STDLIB.H memchr STRING.H memcmp STRING.H memcpy STRING.H memmove STRING.H memset STRING.H mktime* modf perror* pow* printf* putc* putchar* puts* qsort* rand realloc* remove * rename* rewind * scanf* setbuf setvbuf sin* sinh* TIME.H MATH.H STDIO.H MATH.H STDIO.H STDIO.H STDIO.H STDIO.H STDLIB.H STDLIB.H STDLIB.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H STDIO.H MATH.H MATH.H

sleep* sprintf sqrt* srand sscanf strcat* strchr * strcmp* strcmpl* strcpy* strcspn* strdup * strerror strftime* strlen* strlwr* strncat* strncmp* strncpy* strnset* strpbrk* strrchr * strspn* strstr* strtod strtok strtol strtoul strupr* system* tan* tanh* time* tmpfile tmpnam* tolower toupper ungetc*

TIME.H STDIO.H MATH.H STDLIB.H STDIO.H STRING.H STRING.H STRING.H STRING.H STRING.H STRING.H STRING.H STRING.H TIME.H STRING.H STRING.H STRING.H STRING.H STRING.H STRING.H STRING.H STRING.H STRING.H STRING.H STDLIB.H STRING.H STDLIB.H STDLIB.H STRING.H STDLIB.H MATH.H MATH.H TIME.H STDIO.H STDIO.H CTYPE.H CTYPE.H STDIO.H

void sleep(time_t); int sprintf(char *, const char *, ...); double sqrt(double); void srand(unsigned); int sscanf(const char *, const char *, ...); char *strcat(char *,const char *); char *strchr(const char *, int); int strcmp(const char *, const char *); int strcmpl(const char *, const char *); char *strcpy(char *, const char *); size_t strcspn(const char *, const char *); char *strdup(const char *); char *strerror(int); size_t strftime(char *, size_t, const char *, const struct tm *); size_t strlen(const char *); char *strlwr(char *); char *strncat(char *, const char *, size_t); int strncmp(const char *, const char *, size_t); char *strncpy(char *, const char *, size_t); char *strnset(char *, int, size_t); char *strpbrk(const char *, const char *); char *strrchr(const char *, int); size_t strspn(const char *, const char *); char *strstr(const char *, const char *); double strtod(const char *, char **); char *strtok(char *, const char*); long strtol(const char *, char **, int); unsigned long strtoul(const char*, char **, int); char *strupr(char *); int system(const char *); double tan(double); double tanh(double); time_t time(time_t *); FILE *tmpfile(void); char *tmpnam(char *); int tolower(int); int toupper(int); int ungetc(int, FILE *); 425

va_arg* va_end * va_start* vfprintf

STDARG.H (type) va_arg(va_list, (type)); STDARG.H void va_end(va_list); STDARG.H void va_start(va_list, lastfix); STDIO.H int vfprintf(FILE *, constchar *, ...); int vprintf(FILE*, constchar *, ...); int vsprintf(char *, constchar *, ...); size_t wcstombs(char *, const wchar_t *, size_t); int wctomb(char *, wchar_t);

vprintf STDIO.H vsprintf STDIO.H wcstombs STDLIB.H wctomb STDLIB.H

426

You might also like