/ft_printf

Custom Printf Function in C πŸš€

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.