{"id":28320160,"url":"https://github.com/allancrabelo/ft_printf","last_synced_at":"2026-06-28T22:31:51.267Z","repository":{"id":280857591,"uuid":"943410647","full_name":"allancrabelo/Ft_Printf","owner":"allancrabelo","description":"The printf project at 42 was a challenging and rewarding experience, where I implemented my own version of the printf function. I explored variable argument handling, data formatting, and specifiers like %d, %s, and %f. It deepened my understanding of C's internal workings, testing my skills and creativity.","archived":false,"fork":false,"pushed_at":"2025-07-25T17:45:32.000Z","size":1592,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-26T00:11:13.671Z","etag":null,"topics":["42school","buffer","character","conversion","cprogramming","hexadecimal","integer","optimization","output","parsing","printf","recursion","string"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allancrabelo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-05T17:00:39.000Z","updated_at":"2025-07-25T17:45:35.000Z","dependencies_parsed_at":"2025-04-18T22:54:29.908Z","dependency_job_id":"de68c2df-fc95-4462-8baf-89017cc1b73a","html_url":"https://github.com/allancrabelo/Ft_Printf","commit_stats":null,"previous_names":["allancrabelo/printf","allancrabelo/ft_printf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/allancrabelo/Ft_Printf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancrabelo%2FFt_Printf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancrabelo%2FFt_Printf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancrabelo%2FFt_Printf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancrabelo%2FFt_Printf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allancrabelo","download_url":"https://codeload.github.com/allancrabelo/Ft_Printf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancrabelo%2FFt_Printf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34906700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42school","buffer","character","conversion","cprogramming","hexadecimal","integer","optimization","output","parsing","printf","recursion","string"],"created_at":"2025-05-25T10:08:28.698Z","updated_at":"2026-06-28T22:31:51.262Z","avatar_url":"https://github.com/allancrabelo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://img.shields.io/badge/C-00599C?style=for-the-badge\u0026logo=c\u0026logoColor=white\"\u003e\u003c/img\u003e\n\n![Design sem nome(6)](https://github.com/user-attachments/assets/87775e05-7e9b-4b2a-abe8-9f39b58bd63c)\n\n# 🧠 From Stone Tablets to Syscalls\n\nSince the dawn of civilization, writing has been the **ultimate cheat code** — a hack for memory, power, and legacy.\n\nThe Sumerians carved ideas into clay with reed styluses. They didn’t know it yet, but that was humanity’s **first commit**.\nPublic documentation before public repos. Versioning without version control.\nMake a mistake? Too bad. No `git revert`.\nJust smash the tablet and start over — literally a `rm -rf ./history`.\n\nThen time marched on. From clay to papyrus, parchment to Gutenberg, mechanical keyboards to IDEs that autocomplete while you yawn.\nBut the spirit? Still the same. Every letter you type is a negotiation between your brain and the machine. It’s you saying:\n\n\u003e **\"I command. You execute.\"**\n\n---\n\n## 🧔 Dennis Ritchie: The Man Who Printf’ed the World\n\nIn 1972, Dennis Ritchie stared into the void and said:\n\n\u003e “Let’s throw a `printf` in here and see what the hell is going on.”\n\nThat wasn't just a function. That was **a microphone to the soul of the machine**.\nIt was the debugger of the heart.\nIt was the first time someone wrote:\n\n```c\nprintf(\"Hello, world!\\n\");\n```\n\n…and the machine blinked back with a terminal prompt and a binary sigh.\n\nThat moment didn’t just birth the C language.\nIt sparked the entire hacker ethos as we know it.\n\n---\n\n## 🦾 Your Turn to Hold the Pen\n\nNow it’s your turn.\nWith `ft_printf`, you enter the inner circle. But here? No `stdio.h`. No training wheels.\n\nYou're about to **carve your own binary typography** with bare hands and pointer arithmetic.\nNo emotional support from standard libraries.\nIf you want to print `\"42\"` on screen, you're going to **negotiate directly with `write()` like it’s a hostage situation**.\n\nYou’ll finesse pointers like you're picking a digital lock.\nYou’ll convert integers with raw willpower and caffeine.\nAnd each `%x`, `%p`, `%d` you reimplement is a battle cry in the void saying:\n\n\u003e “Relax, Dennis. I’ve got this.”\n\n---\n\n## 🤘 Writing Isn’t Dead. It Was Just Compiled.\n\nToday you print logs, status messages, memory addresses, accented strings, angry errors, and proud successes.\nBut everything — and I mean **everything** — starts with one system call:\n\n```c\nwrite(1, \u0026char, 1);\n```\n\nPoetic, isn’t it?\nYou’re running millions of cycles per second, packing 64GB of RAM, and still… when life hits the fan:\n\n```c\nprintf(\"wtf is happening\\n\");\n```\n\n— Come on, you know that line has saved you more times than you’d admit in public.\n\n---\n\n## 🧘 The ft\\_printf Zen\n\n\u003e “When you understand the difference between `%x` and `%X`,\n\u003e and can handle `(null)` with grace and compassion,\n\u003e then… you may proceed to the next level.”\n\n## 🏅 100% Performance in the Project\n\nDuring the ft_printf project evaluation, I achieved the maximum score of 100%, the result of delivering all mandatory and bonus functionalities with precision, while fully meeting the technical standards required, including:\n\n    ✅ Correct and efficient reimplementation of all standard printf behaviors\n    ✅ Handling of complex format specifiers and flags\n    ✅ Full compliance with Norminette coding standards\n    ✅ Zero memory leaks (Valgrind clean)\n    ✅ Implementation of bonus features, such as extended format support and robust edge-case handling\n\nThis score demonstrates not only deep understanding of C and formatted output logic, but also a strong commitment to code quality, performance, and low-level programming practices — essential values at the core of the 42 curriculum.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/f3a5d881-f36f-440e-bd37-9d618c395e44\" alt=\"Imagem\" /\u003e\n\u003c/p\u003e\n\n## 💡 About the Project\n\n`ft_printf` is a manual reimplementation of the classic C `printf` function. Without relying on standard formatting libraries (`\u003cstdio.h\u003e`), we’re challenged to build a robust system that accepts multiple types, formats strings, converts integers, hexadecimals, and pointers — all while respecting precision, flags, and more.\n\n\n```mermaid\n---\ntitle: Ft_Printf Flow \u0026 Logic (Expanded Layout)\n---\nclassDiagram\n\n    class Ft_Printf {\n        + Iterates through format string  \n        + Detects '%' specifier  \n        + Calls print_* functions  \n    }\n\n    class va_list {\n        + Accesses variadic arguments  \n        + Uses va_start  \n        + Uses va_arg  \n        + Uses va_end  \n    }\n\n    class ft_putchar {\n        + Prints a single character  \n    }\n\n    class ft_putstr {\n        + Prints a string or \"(null)\"  \n    }\n\n    class ft_putnumber {\n        + Prints signed integer  \n    }\n\n    class ft_putunsigned {\n        + Prints unsigned integer  \n    }\n\n    class ft_puthex {\n        + Prints hexadecimal number  \n        + Supports lowercase (x) and uppercase (X)  \n    }\n\n    class ft_putpointer {\n        + Prints pointer address in hexadecimal  \n        + Format: 0x...  \n    }\n\n    class write {\n        + System call: write()  \n        + Sends output to stdout  \n    }\n\n    %% Connections from ft_printf\n    Ft_Printf --\u003e va_list\n    Ft_Printf --\u003e ft_putchar\n    Ft_Printf --\u003e ft_putstr\n    Ft_Printf --\u003e ft_putnumber\n    Ft_Printf --\u003e ft_putunsigned\n    Ft_Printf --\u003e ft_puthex\n    Ft_Printf --\u003e ft_putpointer\n\n    %% Output handling\n    ft_print* --\u003e write\n\n```\n\n## 🧠 What You Will Master\n\nWhile building `ft_printf`, I'll internalize fundamental low-level concepts that shape every high-performance language:\n\n    ✅ Pointer manipulation and va_list\n    ✅ Integer-to-string conversion (base 10, 16, and others)\n    ✅ Buffer creation, counters, and flow control\n    ✅ Modularization using structs and dispatch tables\n    ✅ Full control over text formatting (without using printf!)\n\n## 🚀 Technical Challenges Overcome\n\n    ✅ Handling variadic arguments with stdarg.h\n    ✅ Creating specific functions for each format type\n    ✅ Converting negative integers without using itoa()\n    ✅ Safe pointer printing with fallback to (nil)\n    ✅ Accurate character return count (like the real printf)\n\n# 📁 Project Structure\n    📦 ft_printf  \n    ┣ 📂 libft \n    ┃ ┣ 📜 ft_memset.c\n    ┃ ┣ 📜 ft_bzero.c  \n    ┃ ┣ 📜 ft_strncmp.c  \n    ┃ ┗ 📜 ...\n    ┃ 📜 ft_printf.c  \n    ┃ 📜 ft_putchar.c  \n    ┃ 📜 ft_putnumber.c  \n    ┃ ┗ 📜 ...\n\n## 📚 Key Functionalities\n\n🔹 Manual Conversion – Total Control over Output\n\n- `%c`: prints characters directly\n- `%s`: handles strings, including NULL safety\n- `%d`/`%i`: signed integers\n- `%u`: unsigned integers\n- `%x`/`%X`: hexadecimals (lowercase or uppercase)\n- `%p`: pointer formatting with `0x` prefix\n- `%%`: literal percent symbol\n\n## 📖 Technical Glossary\n\n| Concept            | Description |\n|--------------------|-------------|\n| `va_list`          | Type used to traverse variadic arguments |\n| `va_start`         | Initializes the argument list |\n| `va_arg`           | Accesses the next argument |\n| `write`            | System call to print bytes |\n| `itoa`             | Integer-to-string conversion (manual) |\n| `%p`               | Pointer converter: prints memory addresses with `0x` |\n| `recursion`        | Technique used to print numbers without buffer allocation |\n\n---\n\n## 🧠 Helpful Commands During Development\n\n```\n# Compile the project\nmake\n\n# Clean compiled objects\nmake clean\n\n# Clean all (including .a)\nmake fclean\n\n# Recompile from scratch\nmake re\n```\n\n## 🧪 Compile and Test with a Custom Main\n\nTo test your implementation using your own main.c, you can compile it like this:\n\n```\ncc  main.c libftprintf.a \n```\n\n    🔹 Make sure you have already run make so that libftprintf.a exists.\n    🔹 The main.c file should include #include \"ft_printf.h\" to access your functions.\n    🔹 It is acceptable to ignore warnings during compilation, as they are expected for testing the scope and analyzing the results of the project.\n    \n### 🌍 Vision and Impact\n\n`ft_printf` is not just a technical exercise — it's a foundation. It teaches how complex systems interpret, translate, and display reality. From server logs to game console messages, every system communicates. And every digital communication begins with a `print`.\n\nBy building yours from scratch, you step into the heart of software engineering.\n\n---\n\n# 🚧 Tutorials (Coming Soon)\n\nI'm currently working on a detailed tutorial to help others navigate the FT_PRINTF project more efficiently. This section will include:\n\n    📹 Video Guide – A step-by-step walkthrough explaining key concepts and solutions.\n    📄 PDF Guide – A structured document with explanations, tips, and best practices.\n\nStay tuned! The tutorial will be available soon. 🚀\n\n# 🤝 Contributing\n\nIf you're also doing the Piscine, feel free to suggest improvements or share new approaches!\n\n    📬 Contact: If you'd like to discuss solutions or exchange ideas, find me on Discord or GitHub!\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/allancrabelo\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n    \u003cimg src=\"https://github.com/user-attachments/assets/b3000019-31b9-4735-90c2-ea1a72601c1c\" alt=\"Imagem\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallancrabelo%2Fft_printf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallancrabelo%2Fft_printf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallancrabelo%2Fft_printf/lists"}