Skip to content
edfortePublic

About

Re-implementation of printf as a static C library - 42 project

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

ft_printf

A re-implementation of the C standard library printf, packaged as a static library. Project of the 42 Common Core.

Supported conversions

Conversion Output
%c Character
%s String
%p Pointer address in hexadecimal
%d %i Signed decimal integer
%u Unsigned decimal integer
%x %X Hexadecimal (lower / upper case)
%% Percent sign

Returns the number of characters printed, like the original.

Build & use

make            # builds libftprintf.a
cc main.c libftprintf.a -o demo
#include "ft_printf.h"

int main(void)
{
    ft_printf("Hello %s, you are %d years old (%p)\n", "Edoardo", 22, &main);
    return (0);
}

What I learned

Variadic functions (va_list, va_arg), number base conversion and building reusable static libraries with make and ar.

About

Re-implementation of printf as a static C library - 42 project

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages