Skip to content

KHammerschmidt/42cursus-ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧰 ft_printf


Printing output with format specifiers by using variadic arguments
Start date: 05/august/2021
Project status: completed 100/100 points

Github code size in bytes Github repo size Languages used in repo Top used progamming language


💡 About the project

The aim of this project is to re-code libc's printf function with the conversions:
' c ', ' s ', ' p ', ' d ', ' i ', ' u ', ' x ', ' X ' and ' % '.


Requirements

• The function has to handle the following conversions: cspdiuxX%
• The function will be compared against the original printf()
• To create the library command ar must be used
• Don’t implement the buffer management of the original printf()
• Using the libtool command is forbidden
• Executable libftprintf.a has to be created at the root of your repository

Key learning points

  • Handling variadic arguments
  • Organising a complex project with various sub-functions & libraries in sub-directories

🌁 Format specifiers explained

Specifier Meaning
* [c] Prints a single character
* [s] Prints a string (as defined by the common C convention)
* [p] The void * pointer argument has to be printed 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

Clone the repository:

git clone https://github.com/KHammerschmidt/42cursus-ft_printf && 
cd ft_printf &&
git clone https://github.com/KHammerschmidt/42cursus-Libft

To create library libftprintf.a: Create the library archive:

make

About

Recoding the libc's printf function in C.

Topics

Resources

Stars

Watchers

Forks