Skip to content
LuigiFerrari edited this page May 1, 2021 · 7 revisions

Libft

All functions in libft with their respective names and description grouped by header type.

String

Name Description
bzero Erases the data in the n bytes of the memory, by write zeros('\0') to that area.
memset Fills the data in the n bytes of the memory, by write c type to that area.
memcpy Copies n bytes of the memory from source to dest.
memccpy Copies n bytes of the memory from source to dest, stops if the c type is found.
memmove Copies n bytes of the memory from source to dest, the copy is done in reverse order to avoid overlapping.
memcmp Compares n bytes of the memory areas in s1 and s2.
memchr Scans n bytes of the memory for the first instance of c type. Returns a pointer to the matching byte or NULL if c is not found.
memdel Free the given memory and then puts the pointer to NULL
---- --- -- -
strcpy Copies the string from source to dest
strcat Appends the string source to the dest string
strncpy Copies n bytes of the string from source to dest
strncat Appends n bytes of the source string to the dest string
strlcpy Copies size -1(reserved to NULL). Return the total length of the string thats tried to create(source).
strlcat Appends the string source to the dest string where size -1 is the total size of string created. Returns the total length of the string thats was tried created, dest length + source length or size + source length if size is fewer than dest length.
strcmp Compares the two given strings s1 and s2.
strncmp Compares n bytes of the string areas in s1 and s2.
---- --- -- -
strlen Returns the length of the string.
strnlen Returns the length of the string until n or NULL type is found
strclen Returns the length of the string until first instance of c type or NULL type.
strslen Returns the length of the string until first instance of the substr string.
---- --- -- -
strchr Scans the string for the first instance of the c type. Returns a pointer to the matching byte or NULL if c is not found.
strrchr Scans the string for the first instance of the c type from the last byte('\0') to the first. Returns a pointer to the matching byte or NULL if the byte is not found.
strstr Scans the string for the first instance of the substr string. Returns a pointer to the first character of the matching strings.
strnstr Scans n bytes of the string for the first instance of the substr string. Returns a pointer to the frist character of the matching strings.
---- --- -- -
calloc Allocates size bytes and sets the allocate memory with zeros('\0'). Returns a pointer to the first byte of the allocated memory.
strdup Allocates and copies the given string to the allocated string. Returns a pointer to the new string.
substr Allocates and copies a substring terminated in NULL of the given string from start until len.
strjoin Allocates s1 len + s2 len and copies the s1 to the allocated string and then appends s2 to it. Returns a pointer to the start of the new string.
strtrim Allocates and copies the given string without the set in the start and the end of the new string.
split Allocates a array of strings all terminated by '\0' including the array itself (NULL)obtained by spliting s using the character c as a delimiter.
strmapi Applies the function ’f’ to each character of the string ’s’ to create a new string resulting from successive applications of ’f’.

Put

Name Description
putchar Output a character on the screen
putstr Output a string on the screen
putnstr Output a string on the screen until n characters is printed
putcstr Output a string on the screen until c is find it
putsstr Output a string on the screen until a substring s is find it
putnbr Output a integer value on the screen
---- --- -- -
putchar_fd Output a character on a given filedescriptor fd.
putstr_fd Output a string on a given filedescriptor fd.
putendl_fd Output a string with a linebreak in the end on a given filedescriptor fd.
putnbr_fd Output a integer value on a given filedescriptor fd.

Ctype

Name Description
islower Check if character is lowercase letter.
isupper Check if character is uppercase letter.
isalpha Check if character is an alphabet letter.
isdigit Check if character is decimal digit letter.
isalnum Check if character is an alphabet letter or decimal digit letter.
isascii Check if character is an ascii(0 - 127) letter.
isxdigit Check if character is a hexadecimal digit letter.
isspace Check if character is a white-space letter.
isprint Check if character is a pritable letter.
tolower Convert the character from uppercase to lowercase.
toupper Convert the character from lowercase to uppercase.

Conv

Name Description
atoi Converts a string with digits to a integer.
itoa Returns a allocated string converted from a integer.
utoa Returns a allocated string converted from a unsgined integer.
xtoa Returns a allocated string converted from a hexadecimal.
iwtoa Returns a allocated string with minimum size converted from a integer.
tochar Converts the ones of a integer into a char.
utochar Converts the ones of a unsigned integer into a char.
xtochar Converts the ones of a hexadecimal into a char.
nbrcpy Converts a integer to a string from source to dest.
unbrcpy Converts a unsigned integer to a string from source to dest.
xnbrcpy Converts a hexadecimal to a string from source to dest.

Lst

Name Description
lstnew Allocates and returns a new element. The variable 'content' is initialized with the value of the parameter 'content'. The variable 'next' ins initialized to NULL.
lstadd_front Adds the element 'new' at the beginning of the list.
lstadd_back Adds the element 'new' at the end of the list.
lstclear Deletes and free the given element and every sucessor of that element, using the function 'del' and free.
lstdelone Takes as a parameter an element and frees the memory of the element's content using the function 'del' given as a parameter and free the element.
lstiter Iterates the list 'lst' and applies the function 'f' to the content of each element.
lstlast Returns the last element of the list.
lstmap Iterates the list 'lst' and applies the function 'f' to the content of each element. Creates a new list resulting of the successive applications of the function 'f'. The 'del' function is used to delete the content of an element if needed.
lstsize Counts the number of elements in a list.

Math

Name Description
abs Returns a module of the given number
nbrlen Returns a number of digits of a integer number
unbrlen Returns a number of digits of a unsigned integer number
xnbrlen Returns a number of digits of a hexadecimal number

side

Clone this wiki locally