Skip to content

Custom C library that replicates standard functions and introduces extra utilities for handling strings, memory, and lists. This project serves as a foundation for mastering low-level programming and understanding function implementation in C.

Notifications You must be signed in to change notification settings

pin3dev/42_Libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 

Repository files navigation

Libft

🗣️ Introduction

This repository contains a custom C library, Libft, implemented as part of a coding project.

The objective of the project is to create a static library (.a file) in C that reimplements many of the standard library functions, as well as additional useful functions.

A static library is a collection of object files that are linked directly into the final executable at compile time.
The goal is to gain a deeper understanding of how these functions work internally and to provide a versatile library that can be reused in future C projects without relying on external dependencies.

🧬 Project Structure

The mandatory part of the project involves reimplementing several standard C library functions.
These functions are divided into different subcategories, depending on their purpose.
The primary categories are Libc functions (reimplementations of standard C library functions) and Additional functions (new utility functions added to complement the library).
Within these categories, the functions can be further grouped based on their operations on strings, memory, utility functions, and linked lists.

🗃️ Documentation

For detailed documentation, including usage examples and function breakdowns, please visit the link below:

🫥 Cloning the Repository

To clone this repository and compile the project, run the following commands:

git clone https://github.com/pin3dev/42_Libft.git
cd 42_Libft/libft

This will download the project from GitHub into your local machine in current directory. Once inside the libft directory, you must run make to compile the library.

🕹️ Compilation and Usage

Makefile

A Makefile is provided to automate the compilation process. The Makefile includes the following rules:

  • all: Compiles the library (libft.a).
  • clean: Removes object files.
  • fclean: Removes object files and the library (libft.a).
  • re: Recompiles the entire project.
  • bonus: Compiles the bonus part of the project.
  • test: Compiles the bonus part and runs the test written by @alelievr

To compile the library, simply run:

make

This will generate the libft.a library, which can be linked in other projects to use all functions.

Basic Usage

To use the libft library in your C code, follow the steps below:

  1. Include the header in your code:

    #include "libft/inc/libft.h"
  2. Compile your code with the library:

    gcc -Wall -Wextra -Werror -o your_exec your_code.c 42_Libft/libft/libft.a
  3. You can now use any libft function in your program now!

⚠️ Norms and Guidelines Disclaimer

This project strictly follows the 42 School Norm coding guidelines, which significantly influenced certain decisions in its implementation. These rules may sometimes lead to seemingly inefficient or unusual solutions, but they were necessary to meet the strict requirements of the school.

📖 Theoretical Background

All the theoretical material used to develop this project is organized and can be accessed directly via the link below:

About

Custom C library that replicates standard functions and introduces extra utilities for handling strings, memory, and lists. This project serves as a foundation for mastering low-level programming and understanding function implementation in C.

Topics

Resources

Stars

Watchers

Forks