42_printf

About   |   Features   |   Usage   |   Allowed functions   |   Author


About

The ft_printf library provides a function that mimics the behavior of the original printf function in the C standard library. It is designed to handle various conversion specifiers allowing users to print formatted output to the standard output stream.

Features

  • Mimics the behavior of the original printf function.
  • Supports the following conversion specifiers:
    • %c: Prints a single character.
    • %s: Prints a string (as defined by the common C convention).
    • %p: Prints a void pointer argument in hexadecimal format.
    • %d: Prints a decimal (base 10) number.
    • %i: Prints an integer in base 10.
    • %u: Prints an unsigned decimal (base 10) number.
    • %x: Prints a number in hexadecimal (base 16) lowercase format.
    • %X: Prints a number in hexadecimal (base 16) uppercase format.
    • %%: Prints a percent sign.

Usage

To create the library, run the following command after cloning:

cd ft_printf && make

To test the library, compile your test code along with the ft_printf library as follows:

cd .. && cc -Wall -Wextra -Werror main.c ft_printf/ft_printf.a && ./a.out

Allowed functions

The following functions were allowed to be used in this project:

Function Man Short Description
malloc man 3 malloc Allocates a block of memory dynamically
free man 3 free Deallocates a block of memory
write man 2 write Writes to a file descriptor
va_start man va_start Initializes a va_list for variable arguments
va_arg man va_arg Retrieves the next argument in a va_list
va_copy man va_copy Copies the content of one va_list to another
va_end man va_end Ends traversal of a va_list

Additionally, using the libft library was also allowed.


Made by Boldizsar Szabo