{"id":28042322,"url":"https://github.com/nabilac27/42-ft_printf","last_synced_at":"2025-05-11T14:26:07.723Z","repository":{"id":262140471,"uuid":"886334431","full_name":"nabilac27/42-ft_printf","owner":"nabilac27","description":"an implementation of printf function, utilizing variadic functions to handle formatted output with custom parsing and formatting logic.","archived":false,"fork":false,"pushed_at":"2025-04-10T02:22:05.000Z","size":1560,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T03:27:52.779Z","etag":null,"topics":["dynamic-memory-allocation","error-handling","memory-management","string-formatting","string-manipulation","variadic-function"],"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/nabilac27.png","metadata":{"files":{"readme":"docs/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}},"created_at":"2024-11-10T18:52:02.000Z","updated_at":"2025-04-10T02:22:09.000Z","dependencies_parsed_at":"2024-11-10T19:43:24.751Z","dependency_job_id":"e0a15480-7078-41ed-a5e3-4462a6c0a4d4","html_url":"https://github.com/nabilac27/42-ft_printf","commit_stats":null,"previous_names":["nabilac27/ft_printf","nabilac27/42-ft_printf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-ft_printf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-ft_printf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-ft_printf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-ft_printf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabilac27","download_url":"https://codeload.github.com/nabilac27/42-ft_printf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253578775,"owners_count":21930599,"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":["dynamic-memory-allocation","error-handling","memory-management","string-formatting","string-manipulation","variadic-function"],"created_at":"2025-05-11T14:26:07.140Z","updated_at":"2025-05-11T14:26:07.703Z","avatar_url":"https://github.com/nabilac27.png","language":"C","readme":"# **ft_printf**\n\nThis repository contains my implementation of the **ft_printf** function, \na core project in the **42 School** curriculum. \n\nThe goal of this project is to recreate the standard C `printf` function \nwhile meeting specific requirements and constraints, \ndeepening the understanding of **variadic functions**, **formatted output**, \nand **memory management**.\n\n## **About ft_printf**\n\n`ft_printf` is a variadic function, meaning it accepts a variable number of arguments. \nThe first argument is a format string that defines how the subsequent arguments are formatted and displayed. \nThe function processes the format string, parsing specifiers like `%d`, `%s`, `%c`, etc., and outputs the corresponding formatted values.\n\n## **Key Concepts**\n\n- **Variadic Functions**: \n  - The `\u003cstdarg.h\u003e` library is used to handle variadic functions, enabling the processing of a variable number of arguments.\n  - Key macros:\n    - `va_start`: Initializes the `va_list` for use.\n    - `va_arg`: Retrieves the next argument from the list.\n    - `va_end`: Cleans up the `va_list` after processing.\n\n- **Return Type**: \n  - The function returns the total number of characters printed.\n  - If an error occurs, `ft_printf` returns `-1`.\n\n---\n\n## **Functions Overview**\n\n| **Function** | **Description** |\n|--------------|-----------------|\n| `ft_printf(const char *str, ...)` | The main function that processes the format string and handles the variadic arguments. It returns the total number of characters printed. |\n| `ft_printf_format(char specifier, va_list arg_ptr)` | A helper function that processes individual format specifiers (e.g., `%c`, `%d`, `%s`). |\n| `ft_printf_c(int c)` | Handles the `%c` format specifier and prints a character. |\n| `ft_printf_s(char *s)` | Handles the `%s` format specifier and prints a string. |\n| `ft_printf_d(int n)` | Handles the `%d` format specifier and prints a signed integer. |\n| `ft_printf_u(unsigned int n)` | Handles the `%u` format specifier and prints an unsigned integer. |\n| `ft_printf_p(void *ptr)` | Handles the `%p` format specifier and prints a pointer address. |\n| `ft_printf_x(unsigned int n, char specifier)` | Handles the `%x` and `%X` format specifiers to print a hexadecimal value (lowercase/uppercase). |\n| `ft_printf_hex(unsigned long n)` | Prints a hexadecimal value (lowercase) of the given unsigned long integer. |\n| `ft_printf_hex_upper(unsigned long n)` | Prints a hexadecimal value (uppercase) of the given unsigned long integer. |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabilac27%2F42-ft_printf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabilac27%2F42-ft_printf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabilac27%2F42-ft_printf/lists"}