Skip to content

abbastoof/ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ft_printf

A custom implementation of the standard C printf() function for the 42 school project. This implementation handles a limited set of format specifiers and aims to replicate some of the basic functionality of the original printf() function.

Files

  • ft_convert_number.c: Handles the conversion of numbers to strings based on the specified base and sign.
  • ft_printf.c: Contains the core implementation of the ft_printf() function.
  • ft_printf.h: Header file containing the function prototypes and necessary includes.
  • ft_putchar.c: Implements the ft_putchar() function which writes a single character to the standard output.
  • ft_putstr.c: Implements the ft_putstr() function which writes a string to the standard output.
  • Makefile: Makefile for building the ft_printf project.

Usage

  1. Compile the project using the provided Makefile by running make.
  2. Include the ft_printf.h header file in your project.
  3. Call the ft_printf() function with the desired format string and arguments.
#include "ft_printf.h"

int main()
{
    ft_printf("Hello, %s! The answer is %d.\n", "world", 42);
    return 0;
}

Supported format specifiers

  • %c: Character
  • %s: String
  • %X: Unsigned hexadecimal integer (uppercase)
  • %x: Unsigned hexadecimal integer (lowercase)
  • %d or %i: Signed decimal integer
  • %u: Unsigned decimal integer
  • %p: Pointer address
  • %%: Literal '%' character

Limitations

This implementation does not support the full set of features provided by the standard printf() function, such as field width, precision, or flags. It is intended for educational purposes and as a basic starting point for further development.

About

reimplementation of Printf function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published