[ Project Completion Date : 2021 - 11 - 24 ]
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.
- Variadic Functions: I delve into the usage of
stdarg.hto manage an undefined number of function arguments, replicating the flexibility of the nativeprintf. - 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
printffunctionality, 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.
- 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.
- 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). ππ οΈ
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.