Skip to content
AlisonCameloPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

This project has been created as part of the 42 curriculum by ALisonCamelo.

ft_printf 🖨️

📌 Description

The ft_printf project involves re-coding C's standard printf() library function. The goal is to gain a deep understanding of variadic functions in C (stdarg.h), formatted string parsing, and efficient memory/buffer output management using low-level system calls.


⚙️ Implemented Conversion Specifiers

Specifier Description Handled File
%c Prints a single character. ft_putchar.c
%s Prints a string of characters (handles NULL). ft_putstr.c
%p Prints a void * pointer argument in hexadecimal format. ft_putptr.c
%d Prints a decimal (base 10) number. ft_putnbr.c
%i Prints an integer in base 10. ft_putnbr.c
%u Prints an unsigned decimal (base 10) number. ft_putunbr.c
%x Prints a number in lowercase hexadecimal (base 16). ft_puthex.c
%X Prints a number in uppercase hexadecimal (base 16). ft_puthex.c
%% Prints a literal percent sign. ft_putchar.c

🛠️ Instructions & Compilation

The project compiles into a static library libftprintf.a using the included Makefile.

Makefile Targets:

  • make or make all: Compiles the source files and creates libftprintf.a.
  • make clean: Removes all compiled object (.o) files.
  • make fclean: Removes object files and the libftprintf.a library.
  • make re: Recompiles the entire project from scratch.

How to use in your own C project:

  1. Compile the library:
    make
    
  2. Include the header in your C code:

#include "ft_printf.h" int main(void) { ft_printf("Hello %s! Address: %p | Hex: %x\n", "Alison", &main, 255); return (0); }

  1. Compile your program with the library: Bash gcc -Wall -Wextra -Werror main.c -L. -lftprintf -o test_printf ./test_printf

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages