This is our own function printf in C that is part of the Holberton framework and first big project for the cohort 11.
- Prototype:
int _printf(const char *, ...);
String
```Input: _printf("%s\n", 'This is a string.');
Output: This is a string.```
Character
```Input: _printf("The first letter in the alphabet is %c\n", 'A');
Output: The first letter in the alphabet is A```
Integer
```Input: _printf("There are %i\n", 12);
Output: There are 12```
Decimal
```Input: _printf("%d\n", 1000);
Output: 1000```
- All files will be compiled on Ubuntu 14.04 LTS
- Programs and functions will be compiled with gcc 4.8.4 using flags -Wall -Werror -Wextra and -pedantic
- Code must follow the Betty style
- Global variables are not allowed
-
write (man 2 write) -
malloc (man 3 malloc) -
free (man 3 free) -
va_start (man 3 va_start) -
va_end (man 3 va_end) -
va_copy (man 3 va_copy) -
va_arg (man 3 va_arg)
- Write function that produces output with conversion specifiers
c,s, and%. - Conversion of specifiers
iandd. - Man page for the created function.
- Conversion of specifier
bprints a decimal number coverted to binary. - Conversion of specifier
Sprints a string but with a condition. - Conversion of specifier
rprints in reverse a string. - Conversion of specifier
Rprints a string in rot13. - Conversion of specifier
uprints a unsigned int. - Conversion of specifier
oprints an octal number. - Conversion of specifier
Xprints hexadecimal numbers in uppercase. - Conversion of specifier
Xprints hexadecimal numbers in lowercase.
- _printf.c: This contains the prototype and makes the different convertions that are in the other files.
- _putchar.c: This file contain the syscall write and print a character to the standar output.
- holberton.h: This file contain all the prototypes and the struct
- print_functions.c: This file has the functions that are mandatory like print strings, chars, integers and decimals.
- print_advance.c: This file has some of the functions that are advanced like print a string in reverse, or the specifier S and the prints rot13 string.