Skip to content

libft is a static C library of essential functions — from character checks and memory operations to string manipulation and linked lists — serving as the foundation for all future 42 projects.

License

Notifications You must be signed in to change notification settings

x0141af92ax/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft

Libft is a custom C library developed as part of the 42 curriculum.
It reimplements standard C library functions and introduces additional utilities for memory management, string handling, and linked lists.
The goal is to strengthen understanding of low-level programming, pointers, and data structures by building a reusable toolkit from scratch.


📚 Project Overview

  • Language: C
  • Output: libft.a (static library)
  • Purpose: Provide a foundation of essential functions for use in future 42 projects
  • Skills Learned:
    • Memory allocation and management
    • String and character manipulation
    • Linked list operations
    • Makefile usage and compilation
    • Debugging and testing

🛠️ Contents

Libft includes implementations of:

  • Libc functions
    Reimplementations of standard functions like:

    • strlen, strcpy, memcpy, atoi, isdigit, toupper, etc.
  • Additional functions
    Helpers for string manipulation, memory handling, and conversions:

    • ft_substr, ft_strjoin, ft_split, ft_itoa, etc.
  • Linked list utilities (Bonus part)
    Functions to create, traverse, and manipulate linked lists (t_list):

    • ft_lstnew, ft_lstadd_front, ft_lstmap, ft_lstclear, etc.

⚙️ Compilation

To compile the library:

make

This will generate:

libft.a

Cleaning and rebuilding:

make clean     # Remove object files
make fclean    # Remove object files + libft.a
make re        # Rebuild everything

Usage

You can include libft in your C projects by linking the compiled library:

gcc main.c -L. -lft -o main

Or directly:

gcc main.c libft.a -o main

Include the header file in your source:

#include "libft.h"

Example:

#include "libft.h"
#include <stdio.h>

int main(void)
{
    char str[] = "Hello, Libft!";
    printf("Length: %zu\n", ft_strlen(str));
    return 0;
}

Project Structure

.
├── Makefile
├── libft.h
├── ft_*.c
└── libft.a

Features

  • Memory: ft_memset, ft_bzero, ft_memcpy, ft_calloc, etc.
  • Strings: ft_strlen, ft_strdup, ft_strjoin, ft_split, etc.
  • Characters: ft_isalpha, ft_toupper, etc.
  • Linked Lists: ft_lstnew, ft_lstadd_front, ft_lstmap, etc.

Author

RIDA SBAA 📧 rsbaa@student.1337.maGitHub Repository

About

libft is a static C library of essential functions — from character checks and memory operations to string manipulation and linked lists — serving as the foundation for all future 42 projects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published