Skip to content

cmunoz-g/ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🖨️ ft_printf

Custom reimplementation of the standard C printf() function. Provides a drop-in ft_printf() alternative designed for integration into libft and other C projects.


Build and run

# Clone
 git clone https://github.com/cmunoz-g/printf.git
 cd printf

# Build static library
 make

This produces libftprintf.a.

Include it in your project:

#include "ft_printf.h"
...
ft_printf("Hello, %s!\\n", "world");

Compile with:

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

Supported conversions

  • %c — character
  • %s — string
  • %p — pointer (hexadecimal)
  • %d — decimal integer
  • %i — integer (base 10)
  • %u — unsigned decimal
  • %x — lowercase hexadecimal
  • %X — uppercase hexadecimal
  • %% — literal percent sign

Implementation details

  • Variadic functions — uses va_start, va_arg, and va_end to handle variable argument lists.
  • Modular design — separate functions for each conversion and formatting rule.

About

ft_printf is a custom implementation of the C standard library function printf(). It supports the main format specifiers (%c, %s, %p, %d, %i, %u, %x, %X, %%) and handles variable arguments with a modular design for easy integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors