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.
- Description
- Tasks
- 0. Write function
- 1. Handle format specifiers
- 2. Create additional helper functions
- Advanced Tasks
- 2. With a face like mine, I do better in print
- 3. What one has not experienced, one will never understand in print
- 4. Nothing in fine print is ever good news
- 5. My weakness is wearing too much leopard print
- 6. How is the world ruled and led to war? Diplomats lie to journalists and believe these lies when they see them in print
- 7. The big print gives and the small print takes away
- 8. Sarcasm is lost in print
- 9. Print some money and give it to us for the rain forests
- 10. The negative is the equivalent of the composer's score, and the print the performance
- 11. It's depressing when you're still around and your albums are out of print
- 12. Every time that I wanted to give up, if I saw an interesting textile, print what ever, suddenly I would see a collection
- 13. Print is the sharpest and the strongest weapon of our party
- 14. The flood of print has turned reading into a process of gulping rather than savoring
- 15. *
- How to Run
- Dependencies
- Author
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
.
π€ Task: Write a function _printf
that produces output according to a format. The function should handle the following conversion specifiers: c
, s
, %
.
π’ Task: Extend _printf
to handle the following conversion specifiers: d
, i
.
π§ Task: Create helper functions to modularize the code, making it easier to handle different data types and formatting requirements.
π Task: Handle the b
specifier to print the binary representation of an unsigned integer.
π‘ Task: Handle the u
, o
, x
, and X
specifiers to print unsigned integers, octal, and hexadecimal values.
π Task: Use a buffer to manage printing more efficiently.
π 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.
π Task: Handle additional format specifiers and edge cases.
π¬ Task: Extend _printf
to handle more complex formatting scenarios.
π΅ Task: Optimize the function to handle large data sets efficiently.
πΌ Task: Add support for printing custom data structures.
π 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.
π‘οΈ Task: Optimize the function for speed and memory usage.
π Task: Ensure robust error handling and edge case management.
π Task: Implement any additional features or optimizations as desired.
-
Clone the repository:
git clone https://github.com/Linf0rd/printf.git
cd printf
-
Compile the programs:
gcc -Wall -Werror -Wextra -pedantic *.c -o printf
-
Run the executables:
chmod +x printf
./printf
-
GCC: Ensure you have the GCC compiler installed. You can install it using:
sudo apt update
sudo apt install build-essential
π¨βπ» Linf0rd