Skip to content

tigran-sargsyan-w/Libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft

Completed: Mandatory + Bonus
🏅 Score: 125/100

42 Logo

Libft is a custom implementation of some key functions from the C standard library, built as part of the curriculum at 42 School. The goal of this project is to deepen our understanding of low-level programming, memory management, and code optimization.


Features

  • Standard C Functions: Replicates many standard library functions such as strlen, strcpy, strcat, and more.
  • Memory Management: Includes functions like malloc, calloc, and custom implementations for memory manipulation (memset, memcpy, etc.).
  • String Manipulation: Custom implementations for string operations (strdup, strchr, strncat, etc.).
  • Additional Utilities: Includes useful utility functions not found in the standard library (e.g., ft_split, ft_itoa).

Table of Contents

  1. Getting Started
  2. Functions Overview
  3. Installation
  4. Usage
  5. Project Structure
  6. Contact

Getting Started

Prerequisites

  • A Unix-like operating system (Linux, macOS, etc.).
  • A C compiler (e.g., gcc).

Cloning the Repository

To clone the repository, run the following command:

git clone https://github.com/<your-username>/libft.git
cd libft

Functions Overview

Here is a quick list of the main functions implemented in this project:

Part 1: Libc Functions

  • String Functions: ft_strlen, ft_strcpy, ft_strcmp, etc.
  • Memory Functions: ft_memset, ft_bzero, ft_memcpy, etc.
  • Character Functions: ft_isalpha, ft_isdigit, ft_toupper, etc.

Part 2: Additional Functions

  • String Utilities: ft_substr, ft_strjoin, ft_split, etc.
  • Number Conversions: ft_itoa, ft_atoi.

Bonus Functions

  • Linked List Functions: ft_lstnew, ft_lstadd_front, ft_lstdelone, etc.

Installation

To build the library, simply run:

make

This will generate a libft.a file that can be linked to your projects.

Cleaning Up

To clean up compiled files, use:

make clean

To remove everything including the library file:

make fclean

Usage

To use the library in your project, include the libft.h header and link the library:

#include "libft.h"

int main(void) {
    char *str = ft_strdup("Hello, Libft!");
    ft_putstr_fd(str, 1);
    free(str);
    return 0;
}

Compile and link with:

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

Project Structure

.
├── includes      # Header files (e.g., libft.h)
├── src           # Source files
├── Makefile      # Makefile for building the library
├── README.md     # Project documentation
└── libft.a       # Compiled library (generated after `make`)

Contact

If you have any questions or suggestions, feel free to reach me out.


Thank you for checking out my Libft project! 😊

About

This project is your very first project as a student at 42. You will need to recode a few functions of the C standard library as well as some other utility functions that you will use during your whole cursus.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors