scndcorp
Available
Work
École 42 ParisStudent, École 42 project

ft_printf, reimplementing printf in C

École 42 project, a C reimplementation of the printf function: parsing the format string, handling conversions (%c %s %p %d %i %u %x %X %%) and variadic arguments (va_args).

École 42 Paris

Challenge

Understand how functions with a variable number of arguments work, along with format handling, by rewriting printf from scratch, without relying on the libc function.

Impact

  • printf function recoded from scratch in C
  • Format parsing and handling of variadic arguments (va_args)
  • Conversions %c %s %p %d %i %u %x %X %%

Context

Built in 2021 as part of the École 42 Paris curriculum.

What was done

A version of printf that parses the format string, reads the variadic arguments (va_start / va_arg / va_end) and applies the conversions by type (%c %s %p %d %i %u %x %X %%), returning the number of characters written.

Stack

The technologies used on this mission.

  • C
  • stdarg.h (va_args)
  • Format parsing
  • Type conversions

A similar project in mind?

Let's talk through your challenges and see how to turn your vision into maintainable, tested technical reality.