https://github.com/mbah24-dev/ft_printf
Recoder la fameuse fonction printf de C
https://github.com/mbah24-dev/ft_printf
Last synced: about 1 year ago
JSON representation
Recoder la fameuse fonction printf de C
- Host: GitHub
- URL: https://github.com/mbah24-dev/ft_printf
- Owner: mbah24-dev
- License: mit
- Created: 2024-11-24T13:41:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-15T14:10:39.000Z (over 1 year ago)
- Last Synced: 2024-12-15T15:21:01.029Z (over 1 year ago)
- Language: C
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ft_printf
For the ft_printf project of the 42 school cursus, we must recreate the famous C library printf function. This project teaches us about variadic arguments as well as structures if we plan to implement printf's extra flags.
- Supported conversions: %, c, s, p, i, d, u, x, X
## Status
Finished: 2024-11-27. Grade: 100/100.
## Usage
``make`` to compile.
### Basic Usage
For example, let's create a ``main.c`` file.
```c
// Include the header
#include "ft_printf.h"
int main(void)
{
// Call the function
ft_printf("Testing ft_printf! %d", 42);
ft_printf("Testing ft_printf! %X", 255);
return (0);
}
```
Compile the ``main.c`` file with the ft_printf library and run the program:
```bash
gcc main.c libftprintf.a && ./a.out
```
Output should be:
```
Testing ft_printf! 42
Testing ft_printf! FF
```
### Advanced Usage: Format Specifiers
The table below lists supported format specifiers:
Specifiers
Format Specifier
Description
%
% followed by another % character writes % to the screen.
c
writes a single character.
s
writes a character string.
p
writes an implementation-defined character sequence defining a pointer address.
d or i
writes a signed integer to decimal representation.
u
writes an unsigned integer to decimal representation.
x or X
writes an unsigned integer to hexadecimal representation.
---
Made by mbah: mbah@student.42.fr