{"id":28278743,"url":"https://github.com/mbdanielcrespo/printf","last_synced_at":"2025-06-29T17:05:25.829Z","repository":{"id":158331355,"uuid":"632623080","full_name":"mbdanielcrespo/Printf","owner":"mbdanielcrespo","description":"This project is a recreation of the printf function, a commonly used output function in C.","archived":false,"fork":false,"pushed_at":"2025-04-16T12:04:11.000Z","size":373,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-21T08:19:01.980Z","etag":null,"topics":["42school","c-programming","educational-project","format-specifiers","hexadecimal","makefile","pointers","printf","recursion"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbdanielcrespo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-04-25T19:45:14.000Z","updated_at":"2025-04-16T12:04:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"b0e5cf54-71b8-40a3-a7b9-e73fdf458a40","html_url":"https://github.com/mbdanielcrespo/Printf","commit_stats":null,"previous_names":["mbdanielcrespo/printf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mbdanielcrespo/Printf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdanielcrespo%2FPrintf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdanielcrespo%2FPrintf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdanielcrespo%2FPrintf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdanielcrespo%2FPrintf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbdanielcrespo","download_url":"https://codeload.github.com/mbdanielcrespo/Printf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdanielcrespo%2FPrintf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260619203,"owners_count":23037274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","c-programming","educational-project","format-specifiers","hexadecimal","makefile","pointers","printf","recursion"],"created_at":"2025-05-21T08:16:41.742Z","updated_at":"2025-06-29T17:05:25.820Z","avatar_url":"https://github.com/mbdanielcrespo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🖨️ ft_printf\n\n![42 Badge](https://img.shields.io/badge/42-ft__printf-brightgreen)\n![Score](https://img.shields.io/badge/Score-100%2F100-success)\n![Language](https://img.shields.io/badge/Language-C-blue)\n![Status](https://img.shields.io/badge/Status-Completed-success)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/byaliego/42-project-badges/main/badges/ft_printfe.png\" alt=\"ft_printf Badge\" width=\"150\" height=\"150\"\u003e\n\u003c/p\u003e\n\n## 📝 Introduction\n\n**ft_printf** is a 42 School project that involves recoding the famous C library function `printf()`. This project is an opportunity to discover variadic functions and improve code organization through a complex task.\n\n\u003e \"By reimplementing printf, you'll learn about handling multiple types of arguments, string formatting, and precise memory management.\"\n\nThe primary goal is to create a function that mimics the behavior of the standard printf function, handling various format specifiers and conversion options.\n\n## 🎯 Project Objectives\n\n- Implement a function that formats and prints data to stdout\n- Handle variable arguments in C\n- Process multiple format specifiers\n- Develop a robust string parsing mechanism\n- Apply proper memory management techniques\n\n## 📋 Function Prototype\n\n```c\nint ft_printf(const char *format, ...);\n```\n\n## ✅ Implemented Format Specifiers\n\n| Specifier | Description | Example |\n|-----------|-------------|---------|\n| **%c** | Single character | `ft_printf(\"%c\", 'X')` → `X` |\n| **%s** | String of characters | `ft_printf(\"%s\", \"hello\")` → `hello` |\n| **%p** | Pointer address in hexadecimal | `ft_printf(\"%p\", ptr)` → `0x7ffeeb9a52e0` |\n| **%d** | Decimal (base 10) integer | `ft_printf(\"%d\", 42)` → `42` |\n| **%i** | Integer in base 10 | `ft_printf(\"%i\", 42)` → `42` |\n| **%u** | Unsigned decimal integer | `ft_printf(\"%u\", 42)` → `42` |\n| **%x** | Hexadecimal (base 16) lowercase | `ft_printf(\"%x\", 42)` → `2a` |\n| **%X** | Hexadecimal (base 16) uppercase | `ft_printf(\"%X\", 42)` → `2A` |\n| **%%** | Percent sign | `ft_printf(\"%%\")` → `%` |\n\n## 🧩 Project Structure\n\nThe project consists of three main files:\n\n```\nft_printf/\n├── Makefile\n├── ft_printf.c       # Main implementation with helper functions\n├── ft_printf_ptr.c   # Functions for handling pointer printing\n└── ft_printf.h       # Header with prototypes and hex strings\n```\n\n## 🛠️ Code Explanation\n\n### **ft_printf.h**\nThis header file includes:\n- Function prototypes for all functions in the project\n- Hexadecimal string definitions for lowercase and uppercase\n- Standard library includes (`unistd.h`, `stdarg.h`)\n- Custom `libft.h` library include\n\n### **ft_printf_ptr.c**\nContains specialized functions for handling pointer arguments:\n\n| Function | Description |\n|----------|-------------|\n| **ft_write_ptr** | Recursively writes a pointer's hexadecimal representation |\n| **ft_print_ptr** | Manages pointer output formatting - prints \"(nil)\" for NULL or \"0x\" prefix followed by address |\n\n### **ft_printf.c**\nContains the main function and helper functions:\n\n| Function | Description |\n|----------|-------------|\n| **ft_print_hex** | Converts and prints unsigned integer in hexadecimal (lowercase or uppercase) |\n| **ft_print_unsigned** | Handles printing of unsigned integers |\n| **ft_is_format** | Analyzes format specifier and routes to appropriate handler function |\n| **ft_printf** | Main function that parses format string and processes variable arguments |\n\n## 🧠 Skills Developed\n\n- Working with variadic functions in C\n- Advanced string parsing and formatting\n- Type conversion and handling\n- Code organization in a modular structure\n- Recursive implementation techniques\n- Memory efficiency in string handling\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \n  ### 📊 Project Stats\n  \n  | Metric | Value |\n  |--------|-------|\n  | Final Score | 100/100 |\n  | Format Specifiers | 9 |\n  | Files | 3 |\n  | Dependencies | libft |\n  \n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/C-00599C?style=for-the-badge\u0026logo=c\u0026logoColor=white\" alt=\"C\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/42-000000?style=for-the-badge\u0026logo=42\u0026logoColor=white\" alt=\"42\"\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbdanielcrespo%2Fprintf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbdanielcrespo%2Fprintf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbdanielcrespo%2Fprintf/lists"}