Skip to content

printf is the C language function to do formatted printing. This repository is based on how to design the proper formatting specification for printf basic function.

Notifications You must be signed in to change notification settings

emmanavarro/printf

Repository files navigation

Bash Shell Open Source Love GitHub contributors

_printf Function

Creating our own C printf function

This project is about creating a simulation of the original printf function. The printf function is used for printing the output. It returns the number of characters that are printed. If there is some error then it returns a negative value.

✔️ Requirements

  • Allowed editors: vi, vim, emacs
  • All your files will be compiled on Ubuntu 14.04 LTS
  • Your programs and functions will be compiled with gcc 4.8.4 using the flags -Wall -Werror -Wextra and -pedantic
  • All your files should end with a new line
  • You are not allowed to use global variables
  • No more than 5 functions per file
  • The prototypes of all your functions should be included in your header file called holberton.h

📑 Synopsis:

int _printf(const char *format, ...);
  • format is a character string. The format string is composed of zero or more directives and conversion specifiers:
Specifier Input example Output example
%c "Printing a char: [%c]\n", 'X' Printing a char: [X]
%s "Printing a string: [%s]\n", "Hello, World" Printing a string: [Hello, World]
%d or %i "Printing a number: [%i]\n", 386 Printing a number: [386]
%% "Printing a percent sign: [%%]\n", % Printing a percent sign: [%]

Note: custom specifiers can be added as needed.

  • (...) the ellipsis sign represents the variable number of input arguments.

⚙️ Compilation

All the code files must be compiled as shown:

gcc -Wall -Werror -Wextra -pedantic *.c

After compilation the executable file should be run ./example.out.

💻 Downloading the repository

The repository should be cloned as shown:

git clone https://github.com/emmanavarro/printf.git

🔗 Resources

👯‍♀️ Authors

Made with ❤️ in

Flow chart

Holberton School - Foundations - Low-level programming & Algorithm

March, 2020.

About

printf is the C language function to do formatted printing. This repository is based on how to design the proper formatting specification for printf basic function.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages