Skip to content

The goal of this project is pretty straightforward. Is an implementation of printf().

Notifications You must be signed in to change notification settings

achrafelkhnissi/ft_printf

Repository files navigation

42cursus' ft_printf

Development repo for 42cursus' ft_printf project
For further information about 42cursus and its projects, please refer to 42cursus repo.


🗣️ About

This project is pretty straight forward. You will recode printf. Hopefully you will be able to reuse it in future project without the fear of being flagged as a cheater. You will mainly learn how to use variadic arguments.

🚀 TLDR: this project consists of coding a library that contains a simplified version (more
information below) of the printf function.

Mandatory

  • format specifiers - cspdiuxX%

🛠️ Usage

Requirements

The library is written in C language and thus needs the gcc compiler and some standard C libraries to run.

Instructions

1. Compiling the library

To compile the library, run:

$ cd path/to/ft_printf && make

2. Using it in your code

To use the library functions in your code, simply include its header:

#include "ft_printf.h"

and, when compiling your code, add the required flags:

-lftprintf -L path/to/libftprintf.a -I path/to/ft_printf.h

Third-party testers

📌 Useful Links

Notes

  1. What is Variadic Functions?
    • Variadic function takes indefinite size arity and a variable number of arguments as a parameter. Situations that you do not know how many parameters pass the function.
  2. what is ellipses (...)?
    • The ellipsis (...) is part of the C language and indicates that there are 0 or more optional arguments.
  3. What is va_list?

  4. What is va_start?
    • gets the address of the first argument.
  5. What is va_arg?
    • dereference the block address and type cast it to the appropriate type. then goes to the next block of memory.
    • What is a "Type Descriptor"?
  6. What is va_end?

  7. Calling convensions!

notes

  • man stdarg

About

The goal of this project is pretty straightforward. Is an implementation of printf().

Topics

Resources

Stars

Watchers

Forks