Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft

A recreation of essential C standard library functions, built from scratch as part of the 42 School curriculum.

Description

Libft is your first project at 42. It involves recreating several functions from the C standard library, as well as additional utility functions that will be useful throughout your studies. This library serves as the foundation for all future C projects at 42.

Features

  • String manipulation functions: ft_strlen, ft_strcpy, ft_strcat, ft_strcmp, etc.
  • Memory management functions: ft_memset, ft_memcpy, ft_memcmp, etc.
  • Character checking functions: ft_isalpha, ft_isdigit, ft_isalnum, etc.
  • Conversion functions: ft_atoi, ft_itoa
  • Linked list functions: ft_lstnew, ft_lstadd, ft_lstdel, etc.

Compilation

make

This will create a libft.a static library file.

Usage

  1. Clone the repository:
git clone https://github.com/bratzwitch/libft.git
cd libft
  1. Compile the library:
make
  1. Include in your project:
#include "libft.h"
  1. Compile your program with the library:
gcc -Wall -Wextra -Werror your_file.c -L. -lft

Example

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

int main()
{
    char *str = "Hello, 42!";
    printf("Length: %zu\n", ft_strlen(str));
    
    char *dup = ft_strdup(str);
    printf("Duplicate: %s\n", dup);
    free(dup);
    
    return (0);
}

Functions Implemented

Part 1 - Libc functions

  • ft_memset, ft_bzero, ft_memcpy, ft_memccpy, ft_memmove, ft_memchr, ft_memcmp
  • ft_strlen, ft_strlcpy, ft_strlcat, ft_strchr, ft_strrchr, ft_strnstr, ft_strncmp
  • ft_atoi, ft_isalpha, ft_isdigit, ft_isalnum, ft_isascii, ft_isprint
  • ft_toupper, ft_tolower, ft_calloc, ft_strdup

Part 2 - Additional functions

  • ft_substr, ft_strjoin, ft_strtrim, ft_split, ft_itoa, ft_strmapi, ft_putchar_fd, ft_putstr_fd, ft_putendl_fd, ft_putnbr_fd

Bonus - Linked list functions

  • ft_lstnew, ft_lstadd_front, ft_lstsize, ft_lstlast, ft_lstadd_back, ft_lstdelone, ft_lstclear, ft_lstiter, ft_lstmap

Requirements

  • GCC compiler
  • Make

Author

Viacheslav Moroz - 42 Student

About

my libft

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages