Skip to content

A foundational 42 project to reimplement essential functions from the C standard library. Covers memory handling, string manipulation, character checks, and linked list operations. This project reinforces core C concepts, pointer logic, and dynamic memory management — all without using the standard library.

Notifications You must be signed in to change notification settings

Aztaban/LIBFT_42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LIBFT – 42 School C Standard Library

This project is a personal implementation of common C standard library functions, developed as part of the 42 school curriculum. It includes essential memory and string operations, character checks, and linked list utilities.

This version passed all mandatory and bonus requirements.

📁 Project Structure

All source and header files are located in the root directory.

✅ Features

Mandatory Part

  • memcpy, memset, bzero, memmove, memcmp, memchr
  • strlen, strlcpy, strlcat, strchr, strrchr, strncmp, strnstr
  • atoi, calloc, strdup
  • isalpha, isdigit, isalnum, isascii, isprint, toupper, tolower
  • putchar_fd, putstr_fd, putendl_fd, putnbr_fd
  • strjoin, strtrim, split, itoa, substr, strmapi, striteri

Bonus Part

  • Singly linked list (t_list) utilities:
    • lstnew, lstadd_front, lstsize, lstlast, lstadd_back
    • lstdelone, lstclear, lstiter, lstmap

🛠️ Build Instructions

Run the following command in the project directory:

make

Compiles only the mandatory part of the library. Creates the static library file libft.a.

make bonus

Compiles both the mandatory and bonus functions (e.g., linked list utilities). Also produces libft.a with all symbols included.

make clean      # Removes object files
make fclean     # Removes object files and libft.a
make re         # Runs fclean and then make

🧪 Usage Example

#include "libft.h"

int main(void)
{
    char *s = ft_strdup("Hello, world!");
    ft_putendl_fd(s, 1);
    free(s);
    return 0;
}

Compile with:

gcc main.c -L. -lft

💡 Note: This command is for testing libft.a in your own programs. The library itself must be compiled using make or make bonus as required by the 42 school project rules.

👤 Author

Martin Justa

About

A foundational 42 project to reimplement essential functions from the C standard library. Covers memory handling, string manipulation, character checks, and linked list operations. This project reinforces core C concepts, pointer logic, and dynamic memory management — all without using the standard library.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published