Score: 102/100
Finished: 20.10.2024
ft_printf
is a custom implementation of the standard printf
function in C. It allows formatted output with various format specifiers and handles multiple data types. This project is part of the 42 School curriculum.
To use ft_printf
, clone the repository in the root of your project using one of the following commands:
git clone [email protected]:blueyaGIT/ft_printf.git
git clone https://github.com:blueyaGIT/ft_printf.git
gh repo clone blueyaGIT/ft_printf
This will create a directory called ft_printf/
. Enter it with the command:
cd ft_printf
ft_printf
is provided in .c
and .h
files, which you can include in your project. To compile a test program, you can use:
gcc -Wall -Wextra -Werror ft_printf.c ft_printf_utils.c main.c -o printf
#include <stdio.h>
#include "ft_printf.h"
int main(void)
{
int value = 42;
ft_printf("Hello, World! Value: %d\n", value);
return (0);
}
ft_printf.c
- Contains theft_printf()
function implementation.ft_printf.h
- Header file with function prototypes and necessary includes.ft_*.c
- Utility functions used byft_printf()
.
Formats and prints data to the standard output based on format specifiers.
- Returns the number of characters printed (excluding
\0
). - Supports format specifiers such as
%c
,%s
,%d
,%i
,%u
,%x
,%X
, and%p
.
- Ensure proper handling of variable arguments to avoid undefined behavior.
- The function is designed to mimic standard
printf
but does not support all its features. - Memory allocation is not required unless additional dynamic operations are introduced.
For more details, refer to the project documentation or the 42
subject PDF.