My very first library in C, made for 42 School.
This repository contains a collection of functions that replicate some of the standard C library functions as well as introduce additional utility functions. The library is primarily intended for use within the 42 School curriculum.
The Libft library provides a range of functions to perform various operations on strings, files, and linked lists. It serves as a foundational toolset for C programming, aiding in tasks such as memory manipulation, string processing, and data structure management. Some functions are optimized for performance, while others provide essential utilities.
Warning
During the 42 curriculum you are required to develop and use your Libft library.
Requirements:
- Clang 12
- GNU Make
Steps:
- Clone this repository to your local machine.
- Navigate to the repository's root directory.
- Run
make -C ./libft
to compile the library.
A compiled library named libft.a
will be generated. You can link this library
with your C programs to access the provided functions.
This repository contains a Nix Flake that provides a Nix package for Libft:
You can build the library using nix build
:
nix build github:vinicius507/libft#libft
Or add it to a nix develop
shell:
{
inputs = {
nixpkgs.url = "nixpkgs";
libft = {
url = "github:vinicius507/libft";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
libft,
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [
libft.overlays.libft
libft.overlays.devshell # Overrides the stdenv from mkShell to use clang 12
self.overlays.ft_malcolm
];
};
in {
devShells.${system}.default = pkgs.mkShell {
# Adds the libft library and header file to the shell LIBRARY_PATH and C_INCLUDE_PATH
packages = [pkgs.libft];
};
};
}