Libraries in C Language
Libraries in C Language
#include <stdio.h>
clearerr fclose end of file error fflush fgetc fgetpos
fgets open format fprintf fputc fputs fread
freopen fscanf fseek fsetpos ftell fwrite getc
getchar gets perror printf putc putchar puts
remove rename rewind scanf setbuf setybuf sprintf
sscanf tmpfile tmpnam ungetc vfprintf vprintf vsprintf
#include <stdlib.h>
abort abs atexit atof atoi atoll bsearch
calloc div exit free getenv labs ldiv
malloc mblen multibyte string to wide character
qsort string rand Realloc
srand strtod string to longsystem wctomb
#include <string.h>
memchr memcmp memcpy memmove memset strcat strchr
strcmp strcoll strcpy strcspn strerror strlen strmcat
strmcmp strmcpy strpbrk strrchr strspn strstr strtok
strxfrm
#include <ctype.h>
tolower
#include <locale.h>
localeconv setlocale
#include <math.h>
Acos Asin atan atan2 ceil cos cosh
Exp Fabs floor fmod frexp ldexp log
log10 modf pow without sinh sqrt tan
tanh
#include <setjmp.h>
longjmp setjmp
#include <signal.h>
raise signal
#include <time.h>
asctime clock ctime difference in Gmtime
time localtime mktime
strftime time
Other libraries that do not have associated functions. But they have constant macros and/or
structures.
#include <assert.h>
#include <errno.h>
#include <float.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
SUMMARY OF LIBRARIES
assert.h Contains a macro for diagnostics within programs.
ctype.h Contains several functions for type checking and transformation of
characters.
errno.h contains various macros used to report errors.
limits.h contains several macros that define constants for type size
integers.
float.h contains several macros that define constants for the size of type
floating.
locale.h contains several macros, functions, and types for local units, such as
monetary unit, time, digits, etc.
math.h Contains a macro and several mathematical functions.
setjmp.h Contains declarations that provide a way to avoid the sequence
normal function call and return.
signal.h contains a type, two functions, and several macros for handling conditions
exceptions that occur during execution, such as an interrupt signal
from an external source or an execution error.
stdarg.h contains a type and three macros that provide resources for traversing a
list of function arguments of unknown size and type.
stddef.h Contains various types and macros that are also defined in others
libraries, like size_t.
stdio.h contains types, macros, and functions for performing I/O tasks.
stdlib.h Contains types, macros and functions for numerical conversion, generation
of random numbers, searching and sorting, memory management and tasks
similar.
string.h Contains types, macros, and functions for string manipulation
characters.
time.h Contains types, macros, and functions for the manipulation of information
about dates and times.
Types: char, int, float, long, long long, short, double, void.
FORMAT CHAINS
d, i signed decimal integer
c a character
s null-terminated string
p pointer
ESCAPE SEQUENCE
\a Alert
Space behind
\f Page break
\n Line break
\r Car return
\t Horizontal tabulation
\v Vertical tabulation
\\ Backslash
\' Simple comma
\" Double quotes
Visualize acharacterwhoseASCII codeit's OOO in octal
Visualize a character whose codeASCIIis HHH in
hexadecimal
Functionality of the System Function, which belongs to the library
<stlib.h>
Background Colors
0 = Black
Blue
2 = Green
Aquamarine
4 = Red
Purple
6 = Yellow
White
Gray
Light blue
Font Colors
light green
b = Light aquamarine
Light red
Light purple
light yellow
f = Bright white
For those who are interested, here is a list with the names of all the standard libraries.
C and the functions that each one contains.
I left the titles of the libraries and the variables in English since those of us who program take them.
better with that language (at least at the time of programming itself) than with our Spanish
of birth.
. stdio.h
. ctype.h
. string.h
. math.h
. stdlib.h
. assert.h
. setjmp.h
. signal.h
. time.h
Input and Output: <stdio.h>
. 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(void)
. char *tmpnam(char s[L_tmpnam])
. int setvbuf(FILE *stream, char *buf, int mode, size_t size)
. void setbuf(FILE *stream, char *buf)
. int fprint(FILE *stream, const char *format, …)
. int sprintf(char *s, const char *format, ...)
. vprintf(const char *format, va_list arg)
. vfprintf(FILE *stream, const char *format, va_list arg)
. 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)
. int fputs(const char *s, FILE *stream)
. int getc(FILE *stream)
. int getchar(void)
. char *gets(char *s)
. int putc(int c, FILE *stream)
. int putchar(int c)
. int ungetc(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)
Character Class Tests: <ctype.h>
. isalnum(c)
. isalpha(c)
. iscntrl(c)
. isdigit(c)
. isgraph(c)
. islower(c)
. isprint(c)
. ispunct(c)
. isspace(c)
. isupper(c)
. isxdigit(c)
String Functions: <string.h>
. char *strcpy(s, ct)
. char *strncpy(s, ct, n)
. char *strcat(s, ct)
. char *strncat(s, ct, n)
. int strcmp(cs, ct)
. int strncmp(cs, ct, n)
. char *strchr(cs, c)
. char *strrchr(cs , c)
. size_t strspn(cs, ct)
. size_t strcspn(cs , ct)
. char *strstr(cs, ct)
. size_t strlen(cs)
. char *strerror(n)
. char *strtok(s, ct)
Mathematical Functions: <math.h>
. sin(x)
. cos(x)
. tan(x)
. asin(x)
. acos(x)
. atan(x)
. atan2(x)
. sinh(x)
. cosh(x)
. tanh(x)
. exp(x)
. log(x)
. logarithm base 10 of x
. pow(x,y)
. sqrt(x)
. ceil(x)
. floor(x)
. fabs(x)
. ldexp(x)
. frexp(x, double *ip)
. modf(x, double *ip)
. fmod(x,y)
Utility Functions: <stdlib.h>
. double atof(const char *s)
. int atoi(const char *s
. long atol(const char *s)
. double strrod(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)
. 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)
. void exit(int status)
. int atexit(void (*fcn)(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)
Diagnostics: <assert.h>
. void assert(int expression)
Non-local Jumps: <setjmp.h>
. int setjmp(jmp_buf env)
. void longjmp(jmp_buf env, int val)
Signals: <signal.h>
. void (*signal(int sig, void (*handler)(int)))(int)
Data and Time Functions: <time.h>
. clock_t clock(void)
. time_t time(time_t, *tp)
. double difftime(time_t time2, time_t time1)
. time_t mktime(struct tm *tp)
. char *asctime(const time_t *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)