← Back to selected work

ft_printf

A C implementation of core `printf()` behavior using variadic arguments and format dispatch.

Role
1337 / 42 Developer
Access
1337 / 42 validated project
[01]

Context

A C implementation of core `printf()` behavior using variadic arguments and format dispatch. It supports character, string, pointer, decimal, unsigned, and hexadecimal conversions with explicit edge-case handling.

[02]

My responsibility

Built and validated through the 1337 / 42 project curriculum, with direct responsibility for implementation, debugging, testing, and evaluation requirements.

[03]

System scheme

Engineering scheme

Variadic format dispatch

Input → Processing → Output

The formatter parses each conversion token, dispatches to a type-specific writer, and returns the exact emitted character count.

  1. 01

    Format string

    Scan literal characters and conversion markers.

  2. 02

    Token parser

    Identify the requested conversion type.

  3. 03

    Variadic argument

    Read the matching promoted value from `va_list`.

  4. 04

    Type formatter

    Convert strings, numbers, pointers, and hexadecimal values.

  5. 05

    Output writer

    Write formatted bytes without relying on standard printf.

  6. 06

    Count result

    Track and return the total number of emitted characters.

Variadic types
Base conversion
Null handling
Return semantics
[05]

Technical scope

C01
Variadic Functions02
[07]

Implementation details

  • Format string: Scan literal characters and conversion markers.
  • Token parser: Identify the requested conversion type.
  • Variadic argument: Read the matching promoted value from `va_list`.
  • Type formatter: Convert strings, numbers, pointers, and hexadecimal values.
  • Output writer: Write formatted bytes without relying on standard printf.
  • Count result: Track and return the total number of emitted characters.
[08]

Engineering focus

  • Variadic types remained an explicit concern across the implementation.
  • Base conversion remained an explicit concern across the implementation.
  • Null handling remained an explicit concern across the implementation.
  • Return semantics remained an explicit concern across the implementation.

Need a system like this?

Tell me about the workflow, integration, or backend problem.

Discuss a project