# julenzu/printf-42 architecture

> Architecture diagram of the GitHub repository julenzu/printf-42, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/julenzu/printf-42
- Repository: https://github.com/julenzu/printf-42

## Overview

ft_printf is a small C library that formats a variadic argument list and writes directly to standard output. The main workflow is caller → format parser/dispatcher → conversion-specific printers, whose returned character counts are accumulated for the result. Numeric printers recurse and use the character printer; pointer printing delegates to string and hexadecimal printers. The excerpts show these calls and direct writes; no buffering or broader runtime subsystem is documented.

Main entry points: [`ft_printf.c`](https://github.com/julenzu/printf-42/blob/main/ft_printf.c) (Format dispatcher), [`ft_print_char.c`](https://github.com/julenzu/printf-42/blob/main/ft_print_char.c) (Character output), [`ft_print_hex.c`](https://github.com/julenzu/printf-42/blob/main/ft_print_hex.c) (Hex output), [`ft_print_str.c`](https://github.com/julenzu/printf-42/blob/main/ft_print_str.c) (String output)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_api["Public API<br/>[ft_printf.h]"]
node_formatter["Format dispatcher<br/>[ft_printf.c]"]
node_char_printer["Character output<br/>[ft_print_char.c]"]
node_string_printer["String output<br/>[ft_print_str.c]"]
node_number_printer["Decimal output<br/>[ft_print_nbr.c]"]
node_hex_printer["Hex output<br/>[ft_print_hex.c]"]
node_stdout["Standard output"]

node_caller -->|"includes"| node_api
node_caller -->|"calls"| node_formatter
node_formatter -->|"dispatches to"| node_char_printer
node_formatter -->|"dispatches to"| node_string_printer
node_formatter -->|"dispatches to"| node_number_printer
node_formatter -->|"dispatches to"| node_hex_printer
node_number_printer -->|"prints digits via"| node_char_printer
node_hex_printer -->|"prints digits via"| node_char_printer
node_hex_printer -->|"prints null via"| node_string_printer
node_char_printer -->|"writes bytes"| node_stdout
node_string_printer -->|"writes bytes"| node_stdout

click node_api "https://github.com/julenzu/printf-42/blob/main/ft_printf.h"
click node_formatter "https://github.com/julenzu/printf-42/blob/main/ft_printf.c"
click node_char_printer "https://github.com/julenzu/printf-42/blob/main/ft_print_char.c"
click node_string_printer "https://github.com/julenzu/printf-42/blob/main/ft_print_str.c"
click node_number_printer "https://github.com/julenzu/printf-42/blob/main/ft_print_nbr.c"
click node_hex_printer "https://github.com/julenzu/printf-42/blob/main/ft_print_hex.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller,node_stdout toneIndigo
class node_api toneMint
class node_formatter,node_char_printer,node_string_printer,node_number_printer,node_hex_printer toneTeal
```

## Components

### Other components

- **Library caller**
- [Public API](https://github.com/julenzu/printf-42/blob/main/ft_printf.h): `ft_printf.h`
- [Format dispatcher](https://github.com/julenzu/printf-42/blob/main/ft_printf.c): `ft_printf.c`
- [Character output](https://github.com/julenzu/printf-42/blob/main/ft_print_char.c): `ft_print_char.c`
- [String output](https://github.com/julenzu/printf-42/blob/main/ft_print_str.c): `ft_print_str.c`
- [Decimal output](https://github.com/julenzu/printf-42/blob/main/ft_print_nbr.c): `ft_print_nbr.c`
- [Hex output](https://github.com/julenzu/printf-42/blob/main/ft_print_hex.c): `ft_print_hex.c`
- **Standard output**

## Connections

- Library caller → Public API: includes (evidence: `README.md`)
- Library caller → Format dispatcher: calls (evidence: `README.md`)
- Format dispatcher → Character output: dispatches to (evidence: `ft_printf.c`)
- Format dispatcher → String output: dispatches to (evidence: `ft_printf.c`)
- Format dispatcher → Decimal output: dispatches to (evidence: `ft_printf.c`)
- Format dispatcher → Hex output: dispatches to (evidence: `ft_printf.c`)
- Decimal output → Character output: prints digits via (evidence: `ft_print_nbr.c`)
- Hex output → Character output: prints digits via (evidence: `ft_print_hex.c`)
- Hex output → String output: prints null via (evidence: `ft_print_hex.c`)
- Character output → Standard output: writes bytes (evidence: `ft_print_char.c`)
- String output → Standard output: writes bytes (evidence: `ft_print_str.c`)
