Libft Source Map
#
This guide explains every helper shipped with this libft implementation. For each function you will find the name origin, its core responsibility, and the neighboring helpers it usually collaborates with.
Directory Layout
#
src/char/
β character tests and ASCII case conversions.src/convert/
β numeric/string conversion helpers.src/memory/
β low-level memory manipulation and allocation wrappers.src/string/core/
β foundational string length, copy, and search routines.src/string/builders/
β higher-level string constructors and mappers.src/io/
β file-descriptor output helpers.src/list/
β singly linked-list primitives (reserved for the bonus set).
Character Classification & Case Conversion
#
Function | Name meaning | Primary role | Works closely with |
---|
ft_isalpha | is alpha (alphabetic) | Check whether a byte represents an ASCII letter. | ft_isalnum , ft_tolower , ft_toupper |
ft_isdigit | is digit | Detect ASCII digits 0-9 . | ft_isalnum , ft_atoi |
ft_isalnum | is alphanumeric | Report if the byte is either alphabetic or numeric. | ft_isalpha , ft_isdigit , input validation |
ft_isascii | is ASCII | Verify that a byte value is within the 0β127 ASCII range. | Character checks, sanitizers |
ft_isprint | is printable | Ensure a byte is printable ASCII (space through ~ ). | ft_isascii , logging utilities |
ft_tolower | to lower | Convert an uppercase ASCII letter to lowercase. | ft_isalpha , ft_toupper , text normalization |
ft_toupper | to upper | Convert a lowercase ASCII letter to uppercase. | ft_isalpha , ft_tolower , case-insensitive compares |
Memory Primitives
#
Function | Name meaning | Primary role | Works closely with |
---|
ft_memset | memory set | Fill a block of memory with the same byte. | ft_bzero , buffer initialization |
ft_bzero ] | byte zero | Specialized memset that writes zeroes. | ft_calloc , struct resets |
ft_memcpy | memory copy | Copy bytes between non-overlapping regions quickly. | ft_memmove , string builders |
ft_memmovec ) | memory move | Copy bytes safely even when regions overlap. | ft_memcpy , in-place edits |
ft_memchr | memory char search | Find the first occurrence of a byte in a block. | ft_memcmp , parsers |
ft_memcmp | memory compare | Compare two byte sequences lexicographically. | Sorting helpers, equality checks |
ft_calloc | contiguous alloc | Allocate zero-filled memory for an array. | ft_bzero , ft_split , ft_strdup |
Numeric Conversion
#
Function | Name meaning | Primary role | Works closely with |
---|
ft_atoi | ASCII to integer | Parse a string as a int , handling whitespace and sign. | ft_isdigit , configuration loading |
ft_itoa | integer to ASCII | Render an int into a newly allocated decimal string. | ft_strlen , output formatting |
Core String Utilities
#
Function | Name meaning | Primary role | Works closely with |
---|
ft_strlen | string length | Count bytes up to the terminating '\0' . | Bounds checks, ft_strlcpy , ft_strlcat |
ft_strlcpy | string length copy | Copy to a sized buffer with null-termination awareness. | ft_strlen , safe buffer writes |
ft_strlcat | string length concatenate | Append to a sized buffer while tracking the resulting length. | ft_strlen , ft_strlcpy , buffer sizing |
ft_strchr | string character | Locate the first occurrence of a char in a string. | ft_strrchr , tokenizers |
ft_strrchr | string reverse character | Locate the last occurrence of a char in a string. | ft_strchr , path parsing |
ft_strncmp | string compare (n) | Compare at most n characters lexicographically. | Sorting, prefix checks |
ft_strnstr | string find (n) | Search for a substring within a bounded length. | Parsers, token detection |
ft_strdup | string duplicate | Allocate and copy a C string. | ft_strlen , ft_strlcpy , memory-managed clones |
Higher-Level String Builders
#
Function | Name meaning | Primary role | Works closely with |
---|
ft_strjoin | string join | Concatenate two strings into a freshly allocated result. | ft_strlen , ft_strlcpy , ft_strlcat |
ft_strtrim c) | string trim | Remove a set of characters from both ends of a string. | ft_strchr , ft_substr , ft_strlen |
ft_substr | substring | Extract a segment of a string starting at an index. | ft_strlen , ft_strlcpy , ft_split |
ft_split | split | Break a string on a delimiter into a NULL-terminated array. | ft_substr , ft_calloc , ft_strlen |
ft_strmapi c) | string map indexed | Build a new string by applying a function to each char with index. | ft_strlen , ft_striteri |
ft_striteri | string iterate indexed | Apply a callback to each char in-place, passing the index. | ft_strmapi , mutation helpers |
File-Descriptor Output Helpers
#
Function | Name meaning | Primary role | Works closely with |
---|
ft_putchar_fd | put char (fd) | Write a single character to a file descriptor. | ft_putstr_fd , low-level logging |
ft_putstr_fd | put string (fd) | Send a null-terminated string to a descriptor. | ft_strlen , ft_putendl_fd |
ft_putendl_fd | put endline (fd) | Print a string followed by a newline. | ft_putstr_fd , shell-like outputs |
ft_putnbr_fd | put number (fd) | Render an integer as text to a descriptor. | ft_itoa , ft_putchar_fd |
Linked List Helpers
#
Function | Name meaning | Primary role | Works closely with |
---|
ft_lstnew | lst β list, new β allocate | Create a fresh node with user content; leaves next as NULL . | ft_lstadd_front , ft_lstadd_back , ft_lstmap |
ft_lstadd_front | add node to front of list | Prepend a node in O(1) time by rewiring the head pointer. | ft_lstnew , ft_lstdelone , user-managed head pointer |
ft_lstadd_back | add node to back of list | Append a node at the tail, allocating traversal time as needed. | ft_lstlast , ft_lstnew , ft_lstmap |
ft_lstlast | fetch last list node | Walk to the final node so callers can append or inspect the tail. | ft_lstadd_back , tail-aware user code |
ft_lstsize | list size | Count nodes by linear traversal; useful for diagnostics or loops. | Any iterator that needs bounds or validation |
ft_lstdelone | delete one list node | Free a single node (and optionally its payload) once it is unlinked. | ft_lstclear , user code removing nodes |
ft_lstclear | clear list | Repeatedly delete nodes, leaving the head pointer empty (NULL ). | ft_lstdelone , ft_lstmap error handling |
ft_lstiter | iterate list | Visit each node and apply a side-effect function to its content. | Any transformation pipeline or printer |
ft_lstmap | map list β new list | Build a new list by transforming each content; cleans up on failure. | ft_lstnew , ft_lstadd_back , ft_lstclear |
How These Pieces Fit Together
#
Raw data handling
Memory primitives (ft_mem*
, ft_calloc
, ft_bzero
) give deterministic control over buffers, setting the stage for every higher-level routine.
Validation and parsing
Character checks (ft_is*
, ft_to*
) and numeric conversions (ft_atoi
, ft_itoa
) let you sanitize input before feeding strings into more complex builders or data structures.
String assembly line
Core string utilities measure, copy, or locate data. Builders such as ft_split
and ft_strtrim
compose those basics to reshape text while relying on safe allocation helpers.
Presentation
The ft_put*
family turns your processed data into output directed at any file descriptorβstandard output, logs, or sockets.
Linked data structures
The ft_lst*
suite layers allocation, traversal, and cleanup so you can map, filter, or tear down linked lists without leaks, reusing callbacks (del
, f
) from the other modules.