Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/khammerschmidt/42cursus-ft_printf

Recoding the libc's printf function in C.
https://github.com/khammerschmidt/42cursus-ft_printf

complexity variadic-arguments

Last synced: about 1 month ago
JSON representation

Recoding the libc's printf function in C.

Awesome Lists containing this project

README

        




🧰 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:
```bash
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:
```bash
make
```