Skip to content

Ft_printf is a project where we must replicate the behavior of C library printf function. The project teaches us about variadic arguments as well as data structures.

Notifications You must be signed in to change notification settings

AnaVolkmann/42_FT_PRINTF

Repository files navigation

Ft_Printf

For the ft_printf project of the 42 school cursus, we must recreate the famous C library printf function. This project teaches us about variadic arguments as well as structures if we plan to implement printf's extra flags.

  • Supported conversions: %, c, s, p, i, d, u, x, X

Status

Finished: 04/05/2024 Grade: 100/100.

Usage

make or make bonus to compile.

Basic Usage

For example, let's create a main.c file.

// Include the header
#include "ft_printf.h"

int main(void)
{
      // Call the function
      ft_printf("Testing ft_printf!");
      return (0);
}

Compile the main.c file with the ft_printf library and run the program:

cc main.c libftprintf.a && ./a.out

Output should be:

Testing ft_printf!

Format Specifiers

The table below lists supported format specifiers:

Conversion Short Description
%c Print a single character.
%s Print a string of characters.
%p The void * pointer argument is printed in hexadecimal.
%d Print a decimal (base 10) number.
%i Print an integer in base 10.
%u Print an unsigned decimal (base 10) number.
%x Print a number in hexadecimal (base 16), with lowercase.
%X Print a number in hexadecimal (base 16), with uppercase.
%% Print a percent sign.

About

Ft_printf is a project where we must replicate the behavior of C library printf function. The project teaches us about variadic arguments as well as data structures.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published