https://github.com/andersonhsporto/ft-printf
This project focuses on implementing a simplified version of the printf function, commonly used in C programming for formatted output. The implementation replicates some of the key features of printf, allowing for dynamic string formatting and output generation
https://github.com/andersonhsporto/ft-printf
c makefile printf stdarg
Last synced: 12 days ago
JSON representation
This project focuses on implementing a simplified version of the printf function, commonly used in C programming for formatted output. The implementation replicates some of the key features of printf, allowing for dynamic string formatting and output generation
- Host: GitHub
- URL: https://github.com/andersonhsporto/ft-printf
- Owner: andersonhsporto
- Created: 2021-09-07T03:04:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T20:32:11.000Z (4 months ago)
- Last Synced: 2025-04-15T12:18:51.926Z (12 days ago)
- Topics: c, makefile, printf, stdarg
- Language: C
- Homepage:
- Size: 111 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ft_printf
### Custom printf Implementation
This project is a simplified implementation of the printf function, replicating specific format specifiers for educational and practical purposes. The goal is to understand and reconstruct the core functionalities of the widely-used printf function in C.
## Features
The following format specifiers are supported:
Supported Specifiers
- %c: Prints a single character.
- %s: Prints a string of characters.- %p: Prints a void * pointer argument 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) format.
- %%: Prints a percent sign.
### Example Code
```c
int main() {
ft_printf("Character: %c\n", 'A');
ft_printf("String: %s\n", "Hello, World!");
ft_printf("Pointer: %p\n", (void *)0xDEADBEEF);
ft_printf("Decimal: %d\n", 123);
ft_printf("Integer: %i\n", -456);
ft_printf("Unsigned: %u\n", 789u);
ft_printf("Hexadecimal: %x\n", 0x1A3F);
ft_printf("Percent Sign: %%\n");
return 0;
}```
printf manual - [Linux Programmer's Manual](https://man7.org/linux/man-pages/man3/printf.3.html)