Both
Unix and
C were created at
AT&T's Bell Laboratories in the late 1960s and early 1970s. During the 1970s the C programming language became increasingly popular. Many universities and organizations began creating their own variations of the language for their own projects. By the beginning of the 1980s compatibility problems between the various C implementations became apparent. In 1983 the
American National Standards Institute (ANSI) formed a committee to establish a standard implementation of C known as "ANSI C". Part of the resulting standard was the
ANSI C standard library.
The ANSI C standard library consists of 18 C header files which can be included into a programmer's project with a single statement. Each header file contains one or more functions, function prototypes, data type definitions and macros. The contents of these header files follows.
for enforcing assertions when functions execute
- void assert(int expression);
for classifying characters
- int isalnum(int c);
- int isalpha(int c);
- int iscntrl(int c);
- int isdigit(int c);
- int isgraph(int c);
- int islower(int c);
- int isprint(int c);
- int ispunct(int c);
- int isspace(int c);
- int isupper(int c);
- int isxdigit(int c);
- int tolower(int c);
- int toupper(int c);
for testing error codes reported by library functions
for testing floating-point type properties
- FLT_RADIX
- FLT_ROUNDS
- FLT_DIG
- FLT_EPSILON
- FLT_MANT_DIG
- FLT_MAX
- FLT_MAX_EXP
- FLT_MIN
- FLT_MIN_EXP
- DBL_DIG
- DBL_EPSILON
- DBL_MANT_DIG
- DBL_MAX
- DBL_MAX_EXP
- DBL_MIN
- DBL_MIN_EXP
for programming in ISO 646 variant character sets
for testing integer type properties
- CHAR_BIT
- CHAR_MAX
- CHAR_MIN
- INT_MAX
- INT_MIN
- LONG_MAX
- LONG_MIN
- SCHAR_MAX
- SCHAR_MIN
- SHRT_MAX
- SHRT_MIN
- UCHAR_MAX
- UCHAR_MIN
- UINT_MAX
- ULONG_MAX
- USHRT_MAX
for adapting to different cultural conventions
for computing common mathematical functions
- double sin(double x);
- double cos(double x);
- double tan(double x);
- double asin(double x);
- double acos(double x);
- double atan(double x);
- double atan2(double y, double x);
- double sinh(double x);
- double cosh(double x);
- double tanh(double x);
- double exp(double x);
- double log(double x);
- double log10(double x);
- double pow(double x, double y);
- double sqrt(double x);
- double ceil(double x);
- double floor(double x);
- double fabs(double x);
- double ldexp(double x, int n);
- double frexp(double x, int* exp);
- double modf(double x, double* ip);
- double fmod(double x, double y);
for executing nonlocal goto statements
- int setjmp(jmp_buf env);
- void longjmp(jmp_buf env, int val);
for controlling various exceptional conditions
- SIGABRT
- SIGFPE
- SIGILL
- SIGINT
- SIGSEGV
- SIGTERM
- void (*signal(int sig, void (*handler)(int)))(int);
- int raise(int sig);
for accessing a varying number of arguments
- void va_start(va_list ap, lastarg);
- type va_arg(va_list ap, type);
- void va_end(va_list ap);
for defining several useful types and macros
for performing input and output
- FILE
- stdin
- stdout
- stderr
- FILENAME_MAX
- FOPEN_MAX
- TMP_MAX
- FILE* fopen(const char* filename, const char* mode);
- FILE* freopen(const char* filename, const char* mode, FILE* stream);
- int fflush(FILE* stream);
- int fclose(FILE* stream);
- int remove(const char* filename);
- int rename(const char* oldname, const char* newname);
- FILE* tmpfile();
- char* tmpname(char s[L_tmpnam]);
- int setvbuf(FILE* stream, char* buf, int mode, size_t size);
- void setbuf(FILE* stream, char* buf);
- int fprintf(FILE* stream, const char* format, ...);
- int printf(const char* format, ...);
- int sprintf(char* s, const char* format, ...);
- int vfprintf(FILE* stream, const char* format, va_list arg);
- int vprintf(const char* format, va_list arg);
- int vsprintf(char* s, const char* format, va_list arg);
- int fscanf(FILE* stream, const char* format, ...);
- int scanf(const char* format, ...);
- int sscanf(char* s, const char* format, ...);
- int fgetc(FILE* stream);
- char* fgets(char* s, int n, FILE* stream);
- int fputc(int c, FILE* stream);
- char* fputs(const char* s, FILE* stream);
- int getc(FILE* stream);
- int getchar();
- char* gets(char* s);
- int putc(int c, FILE* stream);
- int putchar(int c);
- int puts(const char* s);
- int unget(int c, FILE* stream);
- size_t fread(void* ptr, size_t size, size_t nobj, FILE* stream);
- size_t fwrite(const void* ptr, size_t size, size_t nobj, FILE* stream);
- int fseek(FILE* stream, long offset, int origin);
- long ftell(FILE* stream);
- void rewind(FILE* stream);
- int fgetpos(FILE* stream, fpos_t* ptr);
- int fsetpos(FILE* stream, const fpos_t* ptr);
- void clearerr(FILE* stream);
- int feof(FILE* stream);
- int ferror(FILE* stream);
- void perror(const char* s);
for performing a variety of operations
- double atof(const char* s);
- int atoi(const char* s);
- long atol(const char* s);
- double strtod(const char* s, char** endp);
- long strtol(const char* s, char** endp, int base);
- unsigned long strtoul(const char* s, char** endp, int base);
- int rand();
- void srand(unsigned int seed);
- void* calloc(size_t nobj, size_t size);
- void* malloc(size_t size);
- void* realloc(void* p, size_t size);
- void free(void* p);
- void abort();
- void exit(int status);
- int atexit(void (*fcm)(void));
- int system(const char* s);
- char* getenv(const char* name);
- void* bsearch(const void* key, const void* base, size_t n, size_t size, int (*cmp)(const void* keyval, const void* datum));
- void qsort(void* base, size_t n, size_t size, int (*cmp)(const void*, const void*));
- int abs(int n);
- long labs(long n);
- div_t div(int num, int denom);
- ldiv_t ldiv(long num, long denom);
for manipulating several kinds of strings
- char* strcpy(char* s, const char* ct);
- char* strncpy(char* s, const char* ct, int n);
- char* strcat(char* s, const char* ct);
- char* strncat(char* s, const char* ct, int n);
- int strcmp(const char* cs, const char* ct);
- int strncmp(const char* cs, const char* ct, int n);
- char* strchr(const char* cs, int c);
- char* strrchr(const char* cs, int c);
- size_t strspn(const char* cs, const char* ct);
- size_t strcspn(const char* cs, const char* ct);
- char* strpbrk(const char* cs, const char* ct);
- char* strstr(const char* cs, const char* ct);
- size_t strlen(const char* cs);
- char* strerror(int n);
- char* strtok(char* s, const char* t);
- void* memcpy(void* s, const void* ct, int n);
- void* memmove(void* s, const void* ct, int n);
- int memcmp(const void* cs, const void* ct, int n);
- void* memchr(const char* cs, int c, int n);
- void* memset(char* s, int c, int n);
for converting between various time and date formats
- clock_t
- CLOCKS_PER_SEC
- time_t
- struct tm
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
- int tm_wday;
- int tm_yday;
- int tm_isdst;
- clock_t clock();
- time_t time(time_t* tp);
- double difftime(time_t time2, time_t time1);
- time_t mktime(struct tm* tp);
- char* asctime(const struct tm* tp);
- char* ctime(const time_t* tp);
- struct tm* gmtime(const time_t* tp);
- struct tm* localtime(const time_t* tp);
- size_t strftime(char* s, size_t smax, const char* fmt, const struct tm* tp);
for manipulating wide streams and several kinds of strings
for classifying wide characters
All Wikipedia text
is available under the
terms of the GNU Free Documentation License