This project was graded 110/100.
You know the rules: if a function is not allowed, you can't use it. It sucks right? Well, this is your chance to implement printf()! You'll be able to use it in the following projects, alongside with the other functions you developed so far.
At 42, the C projects are built following a bunch of rules that enforce good coding style. Some of them are:
- No for, do while, switch, case or goto are allowed
- No more than 25 lines per function and 5 functions per file
- No assigns and declarations in the same line (unless static)
- No more than 5 variables in 1 function
...
Unfortunately I implemented the bonus in the same files as the mandatory, so everything will be mixed up
Part | File Name | Functionality |
---|---|---|
Mandatory | libft/ | Contains the files from the libft project |
ft_convert_char.c | Contains the functions to handle the %c conversion | |
ft_convert_hexa.c | Contains the functions to handle the %x and %X conversions | |
ft_convert_integer.c | Contains the functions to handle the %d and %i conversions | |
ft_convert_module.c | Contains the functions to handle the %% conversion | |
ft_convert_pointer.c | Contains the functions to handle the %p conversion | |
ft_convert_string.c | Contains the functions to handle the %s conversion | |
ft_convert_unsigned.c | Contains the functions to handle the %u conversion | |
ft_printf_utils.c | Contains the utilitary functions developed specifically for this project | |
ft_printf.c | Contains the ft-printf function (main loop) and a function to redirect conversions | |
ft_printf.h | Contains the prototypes of every function specifically developed for this project | |
Bonus | ft_flags.c | Contains functions to handle modifiers (only '#', ' ' and '+') |
To compile the library you can either run make
or make bonus
in the terminal. Both make
and make bonus
will compile and link all files together.
Both rules generate a libftprintf.a
file, which is zipped version of all the object files. Imagine you have a main.c
file and you want to use your library in it. You can compile it by running the following command:
$ cc -Wall -Wextra -Werror main.c -lftprintf -L _path_to_this_folder_/libftprinf.a -I _path_to_this_folder_/ft_printf.h
Dont forget to include the .h
files!
This project was tested using the printfTester and manual revision only.
Feel free to ask me any questions through Slack (ncarvalh).