- Recreating 28 standard library functions in C language
- Project done at WeThinkCode JHB campus (based on 42 france coding curriculum)
- More info on WeThinkCode: https://www.wethinkcode.co.za/
- More info on 42 school(US based school English site): https://www.42.us.org/
- More info on 42 school(France based school French site): https://www.42.fr/
- C
- Student are given the prototype for functions and must re-create behaviors as the originals
- Heap allocated memory space must be properly freed when necessary (e.g use for
Malloc
) - A
Makefile
must be used to create a static library calledlibft.a
- To use functions in library the header
libft.h
is used - To get a full project outline please refer to the pdf
- Create a new folder (e.g
test_libft
) git clone
repo insidetest_libft
- Enter
/libft
folder - To compile
Makefile
type:
make re
- Go back to
/test_libft
- Inside
/test_libft
create a .c file (e.g.test.c
) - Open
test.c
and add library header#include 'libft/libft.h'
- Create a int main()
- Call a function from
libft.h
(e.g.ft_putstr("Hello World")
) <-ft_putstr()
is a LIBFT function to display a string to standard output - To compile file type:
gcc test.c libft/libft.a
- To execute file type:
./a.out
- You should see
Hello World
displayed to standard output
make re
- recompile library when changes are made to functionsmake clean
- removes all function objectsmake fclean
- removes all function objects created with library object