An open API service indexing awesome lists of open source software.

https://github.com/ychaaibi/ft_printf

Custom Printf Function in C πŸš€
https://github.com/ychaaibi/ft_printf

1337school c printf printf-42 variadic-functions

Last synced: 6 months ago
JSON representation

Custom Printf Function in C πŸš€

Awesome Lists containing this project

README

          

# Custom Printf Function in C πŸš€
[ Project Completion Date : 2021 - 11 - 24 ]

## Project Overview πŸ“‹

The project challenges me to replicate the functionality of the C standard library’s `printf` function to `ft_printf`. This function is complex and widely used for formatted output, making it a keystone of C programming. My implementation handles various conversion specifiers, flags, width, precision, and length modifiers, following the genuine behavior of `printf`.

### Development Approach πŸ› οΈ

- **Variadic Functions:** I delve into the usage of `stdarg.h` to manage an undefined number of function arguments, replicating the flexibility of the native `printf`.
- **String Processing:** String manipulation lies at the heart of this project as I work through parsing format strings, generating output, and managing buffers.
- **Modularity:** The code is structured into modular components, each handling different aspects of `printf` functionality, facilitating readability and maintainability.
- **Unit Testing:** Rigorous test cases are developed to cover a wide range of input scenarios, ensuring the reliability and robustness of `ft_printf`.

### Highlights ✨

- **Supported Features:** Custom implementation supports various features including conversion specifiers (`%c`, `%s`, `%d`, `%i`, `%u`, `%x`, `%X`, `%o`, `%p`, `%S`, and `%%`).
- **Format String Compliance:** My code closely emulates the parsing of format strings and handles compound formatting options consistently with the standard `printf`.

### Additional Features 🌟

- **Manage any combination of the following flags: ’-0.’ and the field minimum width under all conversions.**
- **Manage all the following flags: ’# +’ (Yes, one of them is a space).** πŸŒŸπŸ› οΈ

## Project Conclusion πŸŽ“

Through this project, I deepened my understanding of the C language internals and developed a solid intuition for how high-level functions can be broken down into discrete, logical operations. Emphasizing hands-on practice, comprehensive testing, and attention to detail, I effectively created a close approximation of one of the most intricate standard library functions.