42-Seoul-Cursus / ft_printf

My printf function

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ft_printf

The ft_printf project is part of the 42 school curriculum, challenging students to implement their own version of the standard C library's printf function. This project aims to deepen understanding of variadic functions and improve string manipulation skills in C.

Overview

The ft_printf function mimics the behavior of the standard printf function and supports a subset of its format specifiers. Key features include:

  • String formatting: %s, %c, %d, %i, %u, %x, %X, %p, and more.
  • Width and precision: Specifying field width and precision with the * or numeric values.
  • sFlags: Supporting flags such as 0, -, +, (space), and #.

Usage

  1. Clone the project:
git clone https://github.com/seungwonme/ft_printf
  1. Navigate to the project directory:
cd ft_printf && rm -rf .git
  1. Compile the library:
make
  1. Link the library in your project and include the header file:
#include "ft_printf.h"

int main(void)
{
    ft_printf("Formatted output: %s %d\n", "Hello", 42);
    return 0;
}
  • To clean up object files:
make clean
  • To delete all build files:
make fclean
  • To clean and rebuild the library:
make re

Supported Format Specifiers

  • %c: Character
  • %s: String
  • %d and %i: Signed decimal integer
  • %u: Unsigned decimal integer
  • %x and %X: Hexadecimal integer
  • %p: Pointer address

For a complete list of supported features, refer to the ft_printf implementation.

About

My printf function


Languages

Language:C 81.4%Language:Makefile 18.6%