Linf0rd / printf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

printf (0x11. C - printf)πŸ–¨οΈ

Welcome to the printf project! This repository contains a custom implementation of the C library function printf. Understanding how to create your own printf function is an excellent exercise in C programming, providing insight into variable argument lists, formatting, and output.

Table of Contents

Description

This project implements a simplified version of the printf function, which is used to output formatted text. The implementation covers several format specifiers and handles various edge cases to mimic the behavior of the standard printf.

Tasks

0. Write function

πŸ”€ Task: Write a function _printf that produces output according to a format. The function should handle the following conversion specifiers: c, s, %.

1. Handle format specifiers

πŸ”’ Task: Extend _printf to handle the following conversion specifiers: d, i.

2. Create additional helper functions

πŸ”§ Task: Create helper functions to modularize the code, making it easier to handle different data types and formatting requirements.

Advanced Tasks

2. With a face like mine, I do better in print

πŸ“„ Task: Handle the b specifier to print the binary representation of an unsigned integer.

3. What one has not experienced, one will never understand in print

πŸ”‘ Task: Handle the u, o, x, and X specifiers to print unsigned integers, octal, and hexadecimal values.

4. Nothing in fine print is ever good news

πŸ“œ Task: Use a buffer to manage printing more efficiently.

5. My weakness is wearing too much leopard print

πŸ† Task: Handle custom conversion specifiers.

6. How is the world ruled and led to war? Diplomats lie to journalists and believe these lies when they see them in print

πŸ“° Task: Add support for the p specifier to print pointers.

7. The big print gives and the small print takes away

πŸ” Task: Handle additional format specifiers and edge cases.

8. Sarcasm is lost in print

πŸ’¬ Task: Extend _printf to handle more complex formatting scenarios.

9. Print some money and give it to us for the rain forests

πŸ’΅ Task: Optimize the function to handle large data sets efficiently.

10. The negative is the equivalent of the composer's score, and the print the performance

🎼 Task: Add support for printing custom data structures.

11. It's depressing when you're still around and your albums are out of print

πŸ“€ Task: Ensure compatibility with legacy code and standards.

12. Every time that I wanted to give up, if I saw an interesting textile, print whatever, suddenly I would see a collection

🧡 Task: Add support for additional data types and custom format specifiers.

13. Print is the sharpest and the strongest weapon of our party

πŸ—‘οΈ Task: Optimize the function for speed and memory usage.

14. The flood of print has turned reading into a process of gulping rather than savoring

πŸ“š Task: Ensure robust error handling and edge case management.

15. *

🌟 Task: Implement any additional features or optimizations as desired.

How to Run

  1. Clone the repository:

    git clone https://github.com/Linf0rd/printf.git

    cd printf

  2. Compile the programs:

    gcc -Wall -Werror -Wextra -pedantic *.c -o printf

  3. Run the executables:

    chmod +x printf

    ./printf

Dependencies

  • GCC: Ensure you have the GCC compiler installed. You can install it using:

    sudo apt update

    sudo apt install build-essential

Author

πŸ‘¨β€πŸ’» Linf0rd

About


Languages

Language:C 100.0%