Code Monkey home page Code Monkey logo

42-libft's Introduction

Description

This project is a library of useful functions implemented in C. It includes various string manipulation functions, memory management functions, character checking functions, and additional bonus functions. The library is created as part of the 42 school curriculum.

Compilation & Usage

To compile the library, you can use the following commands:

  • make or make all - Compiles the library.
  • make clean - Removes the object files generated during compilation.
  • make fclean - Removes the compiled library and the object files.
  • make re - Performs a clean recompilation of the library.
  • make bonus - Compiles the library including the bonus part. (because this version is the latest, for original libft I suggest switching branch)

To include the libft library in your project and use it in your code, follow these steps:

  1. Compile the libft library using the provided Makefile. This will generate the libft.a file.
  2. Place the libft.a file in a directory of your choice, for example, lib.
  3. In your project directory, create a directory called include if it doesn't already exist.
  4. Copy the header files from the libft library into the include directory. These header files typically have a .h extension, such as libft.h.
  5. In your source code files where you want to use the libft library functions, include the corresponding header file using the following directive:
#include "libft.h"
  1. During compilation, you need to link your project with the libft library. Add the following flag to your compilation command:
-L/path/to/lib -lft
Replace /path/to/lib with the actual path to the directory where you placed the libft.a file.
  1. For example, if you placed the libft.a file in a directory called lib inside your project directory, the compilation command would look like this:
gcc your_program.c -L./lib -lft -o your_program
Now you can use the functions provided by the libft library in your code.
  1. For example, if you want to use the strlen function from the library, you can call it like this:
size_t length = ft_strlen("Hello, world!");
Make sure to prefix the library functions with ft_ to differentiate them from standard library functions.
  1. That's it! You have successfully included the libft library in your project and can use its functions in your code. ๐ŸŽ‰

Default Compilation Flags

The Makefile uses the following compilation flags:

  • -Wall -Wextra -Werror - Enables additional warnings and treats warnings as errors.
  • -I. - Specifies the include directory for header files.

Functions included in library

โ„น๏ธ You can click the function prototype to see the code

Functions from <ctype.h>

Functions from <string.h>

Functions from <stdlib.h>

โญ Bonus part - Linked lists functions <stdlib.h>

Functions from project ft_printf printf() from <stdio.h>

Functions from project get_next_line

Functions from project 42-color

42-libft's People

Contributors

cj4ck avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

invon00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.