Skip to content

PedroDrago/ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ft_printf

This project is about building my own printf function.


Variadic Functions

Variadic functions are functions that receive a number of arguments, i.e., they don't have a fixed number of arguments like regular functions:
//regular function
int is_even(int number);

//variadic function
int are_all_even(int n, ...);

To create a variadic function, we need the tools provided by the <stdarg.h> library. These tools will allow us to create a variadic function and manipulate the variadic number of arguments. I believe these functions will create and manipulate a singly linked list (although I have not confirmed, it makes a lot of sense). Among these tools, the most useful for this project are:

  • va_start: Start the list of arguments, receiving two arguments: A variable from a type provided by the library: va_list and the last fixed argument.
  • va_arg: Will return the current argument from the list, receiving two arguments: the variable that initialized the arguments list and the type that the current argument from the list should have.
  • va_end: Will terminate the arguments list, freeing all the memory allocated in the list.

About

✍🏼 A mini reproduction of the printf function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors