jos-felipe / ft_printf

This project is pretty straightforward, you have to recode printf. You will learn what is and how to implement variadic functions. Once you validate it, you will reuse this function in your future projects.

Home Page:https://man7.org/linux/man-pages/man3/printf.3.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

printf

Write a library that contains ft_printf, a function that will mimic the real printf

Summary

The printf() function produces output according to a format as described below. It writes output to stdout - the standard output stream. The overall syntax of a conversion specification is:

       %[$][flags][width][.precision][length modifier]conversion

Mandatory part

A small description of the required conversion:

  • %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).
  • %X print a number in upper case hexadecimal (base 16).
  • %% print a percent sign.

Bonus part

Manage all the following flags:

Flag Description
# Prefix the string "0x" or "0X" for x and X conversions.
' ' Add a single space (' ') in the front of positive numeric conversions.
+ Add a plus sign ('+') in the front of positive numeric conversions

How to test

make && cc -w -o tester tester.c -L./ -lftprintf && ./tester

About

This project is pretty straightforward, you have to recode printf. You will learn what is and how to implement variadic functions. Once you validate it, you will reuse this function in your future projects.

https://man7.org/linux/man-pages/man3/printf.3.html

License:MIT License


Languages

Language:C 85.7%Language:Makefile 14.3%