/01_printf_42CC

My implementation of printf, which lets you print a formatted string to stdout

Primary LanguageC

Printf

The ft_printf project is a challenge within the 42 School curriculum aimed at deepening students' understanding of variadic functions, formatted output, and string manipulation in C. The goal is to create a function that mimics the behavior of the standard C library's printf function, capable of formatting and printing various types of data.

Task

The task was to implement the ft_printf function, which formats and prints data to the standard output according to a specified format string. The function needs to handle various conversion specifiers such as:

  • Printing different data types, including characters, strings, integers, and hexadecimal values.
  • Managing flags, width, precision, and length modifiers in the format string.
  • Handling edge cases, such as printing NULL strings, negative numbers, and large integers.

Key objectives included:

  • Designing a function that supports a wide range of format specifiers like %d, %s, %x, %p, and more.
  • Ensuring correct parsing and handling of flags, width, precision, and length modifiers to match the behavior of the standard printf.
  • Implementing a robust and efficient solution that handles various edge cases and performs well with different input scenarios.

Key Achievements

  • Comprehensive Format Specifier Support: Successfully implemented a wide range of format specifiers and modifiers, ensuring that ft_printf behaves similarly to the standard printf.
  • Efficient Variadic Function Management: Developed a robust approach to handling variadic arguments, allowing the function to dynamically manage different types and numbers of input parameters.
  • Modular and Maintainable Code: Created a modular and reusable codebase with clear separation of concerns, making the function easy to maintain and extend for future enhancements.

Installation

To install the Project, follow these steps:

  1. Clone the repository: git clone git@github.com:jakobsitory/01_printf_42CC.git
  2. Navigate to the project directory: cd 01_printf_42CC
  3. Build the project: make

Usage

  1. Install francinette to test the function: https://github.com/xicodomingues/francinette"
  2. Open the project directory and run francinette to run extensive tests