# yildirimmmm/ft_printf architecture

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

- Interactive diagram: https://gitdiagram.com/yildirimmmm/ft_printf
- Repository: https://github.com/yildirimmmm/ft_printf
- Video tour (about a minute): https://gitdiagram.com/yildirimmmm/ft_printf/video

## Overview

ft_printf is a small printf-style formatting library. A caller supplies a format string and variadic arguments; the entry point emits literal characters and sends each conversion to the format parser, which dispatches supported specifiers to conversion handlers. Handlers format values through output utilities, and the library returns a character count. The README gives no further capability details; links from unsampled handlers are omitted where their calls cannot be confirmed.

Main entry points: [`src/parse_format.c`](https://github.com/yildirimmmm/ft_printf/blob/main/src/parse_format.c) (Format parser), [`utils/ft_putchar_fd.c`](https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_putchar_fd.c) (Character output), [`src/ft_printf.c`](https://github.com/yildirimmmm/ft_printf/blob/main/src/ft_printf.c) (ft_printf), [`src/handle_pointer.c`](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_pointer.c) (Pointer handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_formatting["Format processing"]
  node_entry["ft_printf<br/>[ft_printf.c]"]
  node_parser["Format parser<br/>[parse_format.c]"]
end

subgraph group_conversions["Conversions"]
  node_char["Character handler<br/>[handle_char.c]"]
  node_string["String handler<br/>[handle_string.c]"]
  node_pointer["Pointer handler<br/>[handle_pointer.c]"]
  node_decimal["Decimal handler<br/>[handle_decimal.c]"]
  node_unsigned["Unsigned handler<br/>[handle_unsigned.c]"]
  node_hexlower["Lower hex handler<br/>[handle_hex_lower.c]"]
  node_hexupper["Upper hex handler<br/>[handle_hex_upper.c]"]
  node_percent["Percent handler<br/>[handle_percent.c]"]
end

subgraph group_output["Output utilities"]
  node_putchar["Character output<br/>[ft_putchar_fd.c]"]
  node_putstr["String output"]
  node_putdecimal["Signed number output<br/>[ft_putnbr_fd.c]"]
  node_putunsigned["Unsigned number output"]
  node_puthexlower["Lower hex output<br/>[ft_puthex_lower.c]"]
  node_puthexupper["Upper hex output<br/>[ft_puthex_upper.c]"]
end

node_caller(("Library caller"))
node_stdout["Standard output"]

node_caller -->|"calls"| node_entry
node_entry -->|"parses conversions"| node_parser
node_entry -->|"writes literals"| node_putchar
node_parser -->|"dispatches %c"| node_char
node_parser -->|"dispatches %s"| node_string
node_parser -->|"dispatches %p"| node_pointer
node_parser -->|"dispatches %d, %i"| node_decimal
node_parser -->|"dispatches %u"| node_unsigned
node_parser -->|"dispatches %x"| node_hexlower
node_parser -->|"dispatches %X"| node_hexupper
node_parser -->|"dispatches %%"| node_percent
node_parser -->|"writes unknown specifier"| node_putchar
node_pointer -->|"writes nil marker"| node_putstr
node_pointer -->|"formats address"| node_puthexlower
node_unsigned -->|"formats value"| node_putunsigned
node_hexlower -->|"formats value"| node_puthexlower
node_hexupper -->|"formats value"| node_puthexupper
node_putdecimal -->|"writes digits"| node_putchar
node_putunsigned -->|"writes digits"| node_putchar
node_puthexlower -->|"writes digits"| node_putchar
node_puthexupper -->|"writes digits"| node_putchar
node_putchar -->|"writes bytes"| node_stdout

click node_entry "https://github.com/yildirimmmm/ft_printf/blob/main/src/ft_printf.c"
click node_parser "https://github.com/yildirimmmm/ft_printf/blob/main/src/parse_format.c"
click node_char "https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_char.c"
click node_string "https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_string.c"
click node_pointer "https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_pointer.c"
click node_decimal "https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_decimal.c"
click node_unsigned "https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_unsigned.c"
click node_hexlower "https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_hex_lower.c"
click node_hexupper "https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_hex_upper.c"
click node_percent "https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_percent.c"
click node_putchar "https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_putchar_fd.c"
click node_putdecimal "https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_putnbr_fd.c"
click node_putunsigned "https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_putnbr_unsigned.c"
click node_puthexlower "https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_puthex_lower.c"
click node_puthexupper "https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_puthex_upper.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_entry,node_parser toneBlue
class node_char,node_string,node_pointer,node_decimal,node_unsigned,node_hexlower,node_hexupper,node_percent toneAmber
class node_putchar,node_putstr,node_putdecimal,node_putunsigned,node_puthexlower,node_puthexupper toneMint
class node_caller,node_stdout toneIndigo
```

## Components

### Format processing

- [ft_printf](https://github.com/yildirimmmm/ft_printf/blob/main/src/ft_printf.c): `src/ft_printf.c`
- [Format parser](https://github.com/yildirimmmm/ft_printf/blob/main/src/parse_format.c): `src/parse_format.c`

### Conversions

- [Character handler](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_char.c): `src/handle_char.c`
- [String handler](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_string.c): `src/handle_string.c`
- [Pointer handler](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_pointer.c): `src/handle_pointer.c`
- [Decimal handler](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_decimal.c): `src/handle_decimal.c`
- [Unsigned handler](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_unsigned.c): `src/handle_unsigned.c`
- [Lower hex handler](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_hex_lower.c): `src/handle_hex_lower.c`
- [Upper hex handler](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_hex_upper.c): `src/handle_hex_upper.c`
- [Percent handler](https://github.com/yildirimmmm/ft_printf/blob/main/src/handle_percent.c): `src/handle_percent.c`

### Output utilities

- [Character output](https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_putchar_fd.c): `utils/ft_putchar_fd.c`
- **String output**
- [Signed number output](https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_putnbr_fd.c): `utils/ft_putnbr_fd.c`
- [Unsigned number output](https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_putnbr_unsigned.c): `utils/ft_putnbr_unsigned.c`
- [Lower hex output](https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_puthex_lower.c): `utils/ft_puthex_lower.c`
- [Upper hex output](https://github.com/yildirimmmm/ft_printf/blob/main/utils/ft_puthex_upper.c): `utils/ft_puthex_upper.c`

### Other components

- **Library caller**
- **Standard output**

## Connections

- Library caller → ft_printf: calls
- ft_printf → Format parser: parses conversions
- ft_printf → Character output: writes literals
- Format parser → Character handler: dispatches %c
- Format parser → String handler: dispatches %s
- Format parser → Pointer handler: dispatches %p
- Format parser → Decimal handler: dispatches %d, %i
- Format parser → Unsigned handler: dispatches %u
- Format parser → Lower hex handler: dispatches %x
- Format parser → Upper hex handler: dispatches %X
- Format parser → Percent handler: dispatches %%
- Format parser → Character output: writes unknown specifier
- Pointer handler → String output: writes nil marker
- Pointer handler → Lower hex output: formats address
- Unsigned handler → Unsigned number output: formats value
- Lower hex handler → Lower hex output: formats value
- Upper hex handler → Upper hex output: formats value
- Signed number output → Character output: writes digits
- Unsigned number output → Character output: writes digits
- Lower hex output → Character output: writes digits
- Upper hex output → Character output: writes digits
- Character output → Standard output: writes bytes
