# sylvzzz/ft_printf architecture

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

- Interactive diagram: https://gitdiagram.com/sylvzzz/ft_printf
- Repository: https://github.com/sylvzzz/ft_printf

## Overview

This is a small C printf-style formatting library. A caller passes a format string and variadic arguments to `ft_printf`, which dispatches supported conversions to output routines and returns the number of characters reported. The routines cover characters, strings, signed and unsigned decimals, hexadecimal, pointers, and literal percent signs. Supporting string utilities are included, though `ft_strchr` is not shown participating in formatting. The map follows excerpted calls; the README is empty.

Main entry points: [`ft_printf.c`](https://github.com/sylvzzz/ft_printf/blob/main/ft_printf.c) (Format processor), [`ft_putchar_fd.c`](https://github.com/sylvzzz/ft_printf/blob/main/ft_putchar_fd.c) (Character output), [`ft_putnbr_u_fd.c`](https://github.com/sylvzzz/ft_printf/blob/main/ft_putnbr_u_fd.c) (Unsigned decimal), [`ft_putnbr_fd.c`](https://github.com/sylvzzz/ft_printf/blob/main/ft_putnbr_fd.c) (Signed decimal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_format["Format dispatch"]
  node_printf["Format processor<br/>[ft_printf.c]"]
end

subgraph group_writers["Output routines"]
  node_putchar["Character output<br/>[ft_putchar_fd.c]"]
  node_putstr["String output<br/>[ft_putstr_fd.c]"]
  node_putnbr["Signed decimal<br/>[ft_putnbr_fd.c]"]
  node_putunbr["Unsigned decimal<br/>[ft_putnbr_u_fd.c]"]
  node_puthex["Lowercase hex<br/>[ft_puthex.c]"]
  node_puthexm["Uppercase hex<br/>[ft_puthex_m.c]"]
  node_putptr["Pointer output<br/>[ft_putptr.c]"]
end

subgraph group_strings["String utilities"]
  node_strchr["Character search<br/>[ft_strchr.c]"]
  node_strlen["String length<br/>[ft_strlen.c]"]
end

node_caller(("Library caller"))

node_caller -->|"calls"| node_printf
node_printf -->|"dispatches"| node_putchar
node_printf -->|"dispatches"| node_putstr
node_printf -->|"dispatches"| node_putnbr
node_printf -->|"dispatches"| node_putunbr
node_printf -->|"dispatches"| node_puthex
node_printf -->|"dispatches"| node_puthexm
node_printf -->|"dispatches"| node_putptr
node_putstr -->|"writes via"| node_putchar
node_putnbr -->|"writes via"| node_putchar
node_putunbr -->|"recurses via"| node_putnbr
node_putunbr -->|"writes via"| node_putchar
node_strchr -->|"measures with"| node_strlen

click node_printf "https://github.com/sylvzzz/ft_printf/blob/main/ft_printf.c"
click node_putchar "https://github.com/sylvzzz/ft_printf/blob/main/ft_putchar_fd.c"
click node_putstr "https://github.com/sylvzzz/ft_printf/blob/main/ft_putstr_fd.c"
click node_putnbr "https://github.com/sylvzzz/ft_printf/blob/main/ft_putnbr_fd.c"
click node_putunbr "https://github.com/sylvzzz/ft_printf/blob/main/ft_putnbr_u_fd.c"
click node_puthex "https://github.com/sylvzzz/ft_printf/blob/main/ft_puthex.c"
click node_puthexm "https://github.com/sylvzzz/ft_printf/blob/main/ft_puthex_m.c"
click node_putptr "https://github.com/sylvzzz/ft_printf/blob/main/ft_putptr.c"
click node_strchr "https://github.com/sylvzzz/ft_printf/blob/main/ft_strchr.c"
click node_strlen "https://github.com/sylvzzz/ft_printf/blob/main/ft_strlen.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_printf toneBlue
class node_putchar,node_putstr,node_putnbr,node_putunbr,node_puthex,node_puthexm,node_putptr toneAmber
class node_strchr,node_strlen toneMint
class node_caller toneIndigo
```

## Components

### Format dispatch

- [Format processor](https://github.com/sylvzzz/ft_printf/blob/main/ft_printf.c): `ft_printf.c`

### Output routines

- [Character output](https://github.com/sylvzzz/ft_printf/blob/main/ft_putchar_fd.c): `ft_putchar_fd.c`
- [String output](https://github.com/sylvzzz/ft_printf/blob/main/ft_putstr_fd.c): `ft_putstr_fd.c`
- [Signed decimal](https://github.com/sylvzzz/ft_printf/blob/main/ft_putnbr_fd.c): `ft_putnbr_fd.c`
- [Unsigned decimal](https://github.com/sylvzzz/ft_printf/blob/main/ft_putnbr_u_fd.c): `ft_putnbr_u_fd.c`
- [Lowercase hex](https://github.com/sylvzzz/ft_printf/blob/main/ft_puthex.c): `ft_puthex.c`
- [Uppercase hex](https://github.com/sylvzzz/ft_printf/blob/main/ft_puthex_m.c): `ft_puthex_m.c`
- [Pointer output](https://github.com/sylvzzz/ft_printf/blob/main/ft_putptr.c): `ft_putptr.c`

### String utilities

- [Character search](https://github.com/sylvzzz/ft_printf/blob/main/ft_strchr.c): `ft_strchr.c`
- [String length](https://github.com/sylvzzz/ft_printf/blob/main/ft_strlen.c): `ft_strlen.c`

### Other components

- **Library caller**

## Connections

- Library caller → Format processor: calls (evidence: `ft_printf.c`)
- Format processor → Character output: dispatches (evidence: `ft_printf.c`)
- Format processor → String output: dispatches (evidence: `ft_printf.c`)
- Format processor → Signed decimal: dispatches (evidence: `ft_printf.c`)
- Format processor → Unsigned decimal: dispatches (evidence: `ft_printf.c`)
- Format processor → Lowercase hex: dispatches (evidence: `ft_printf.c`)
- Format processor → Uppercase hex: dispatches (evidence: `ft_printf.c`)
- Format processor → Pointer output: dispatches (evidence: `ft_printf.c`)
- String output → Character output: writes via (evidence: `ft_putstr_fd.c`)
- Signed decimal → Character output: writes via (evidence: `ft_putnbr_fd.c`)
- Unsigned decimal → Signed decimal: recurses via (evidence: `ft_putnbr_u_fd.c`)
- Unsigned decimal → Character output: writes via (evidence: `ft_putnbr_u_fd.c`)
- Character search → String length: measures with (evidence: `ft_strchr.c`)
