https://github.com/marcusvinix/printf
Because putnbr and putstr aren’t enough.
https://github.com/marcusvinix/printf
42 42school ftprintf42
Last synced: 6 months ago
JSON representation
Because putnbr and putstr aren’t enough.
- Host: GitHub
- URL: https://github.com/marcusvinix/printf
- Owner: MarcusVinix
- Created: 2021-06-17T12:54:08.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-19T18:11:28.000Z (almost 5 years ago)
- Last Synced: 2025-01-01T12:12:11.280Z (over 1 year ago)
- Topics: 42, 42school, ftprintf42
- Language: C
- Homepage:
- Size: 304 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FT_PRINTF


> This is a reimplementation of the function printf included in libc.
> This implementation cover the following set of flags and conversions,
> besides the availability of the width and precision modifiers.
### Flags
| Flag | Description |
|------- |-------------------------------------------------------------------------------|
| **-** | Left-justify within the given field width; Right justification is the default.|
| **0** | Left-pads the number with zeroes(0) instead of space. |
| **+** | Add a plus sign '+' int the front of positive numeric conversions |
| ` ` | If no sign is going to be written, a blank space is inserted before the value.|
| **#** | Used with x or X specifiers. Add (0x) in front of values different than zero. |
| **num** | Number between % and the specifier is the minimum field width |
| **.** | precision |
### Conversions
| Specifiers | 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) |
| **%** | Print a percent sign '%' |
> For the specifier d and i, the precision is the minimum number of digits to be print.
> For the specifier s, the precision is the maximum field width.
> Stay tuned when:
> * Flag '0' is ignored when flag '-' is present.
> * Flag '0' is ignored when flag '.' is present (%d e %i)
> * Flag '0' result in undefined behavior with specifier c, s and p
> * FLag '.' result in undefined behavior with specifier c and p
>
> Syntax to use printf:
`%[flag][min-width].[precision][length modifier][conversion specifier]`
***