Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

This project has been created as part of the 42 curriculum by dporhomo.

Libft

ScoreLanguageCompletion Date

💡 About The Project

Libft is the first project of the 42 Core Curriculum. The goal is to create a custom C library named libft.a by rewriting standard C library functions and adding useful utility functions. This library will be used in almost all future 42 projects.

Project Status: ✅ Completed: Mandatory & Bonus Parts.

📂 Function List

Part 1: Libc Functions

Re-implementation of standard C library functions.

CharacterStringMemoryNumbers/Other
ft_isalphaft_strlenft_memsetft_atoi
ft_isdigitft_strlcpyft_bzeroft_calloc
ft_isalnumft_strlcatft_memcpyft_tolower
ft_isasciift_strchrft_memmoveft_toupper
ft_isprintft_strrchrft_memchr
ft_strncmpft_memcmp
ft_strnstrft_strdup

Part 2: Additional Functions

Useful string manipulation functions not present in standard libc.

FunctionDescription
ft_substrAllocates and returns a substring from the string 's'.
ft_strjoinAllocates and returns a new string, result of 's1' + 's2'.
ft_strtrimTrims characters specified in 'set' from start/end of 's1'.
ft_splitSplits a string using a delimiter and returns an array of strings.
ft_itoaConverts an integer to a string (char *).
ft_strmapiApplies a function to each character of a string (creates new string).
ft_striteriApplies a function to each character of a string (in place).
ft_putchar_fdOutputs a char to a file descriptor.
ft_putstr_fdOutputs a string to a file descriptor.
ft_putendl_fdOutputs a string followed by a newline to a FD.
ft_putnbr_fdOutputs an integer to a file descriptor.

Part 3: Bonus Functions (Linked Lists)

Functions to manipulate t_list structures.

FunctionDescription
ft_lstnewCreates a new list node.
ft_lstadd_frontAdds a node to the beginning of a list.
ft_lstsizeCounts the number of nodes in a list.
ft_lstlastReturns the last node of the list.
ft_lstadd_backAdds a node to the end of a list.
ft_lstdeloneDeletes a node and frees its content.
ft_lstclearDeletes and frees a node and all successors.
ft_lstiterApplies a function to the content of every node.
ft_lstmapApplies a function to a list and creates a new list with results.

🛠️ Usage

Requirements

  • gcc or clang compiler.
  • Standard C libraries.

Compilation

To compile the library, run the following in the root directory:

make # Compiles mandatory functions
make bonus # Compiles mandatory + bonus functions
cc -Wall -Werror -Wextra main.c -L. -lft -lbsd -o test_prog

About

Rewriting standard C library functions (libc), including addition of useful utility functions and node manipulation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages