libft
by bhagenlo
written for version 15
Your library at 42 School. Your first project.
And therefore, first things first. You're new here, things are overwhelming. That's okay.
And even more so a reason listen carefully to this advice we want to give:
For starting your work on the libft, you should know how to:#Prerequisites
While working on your libft, you'll (need) get to know: We think you should also get to know: Some Tasks where it makes even more sense than normally to think before you start with coding:#During
malloc()
free()
ft_memmove()
– how can you move the content without loss, even when the locations overlap? (and without copying the content?)ft_strlcpy()
– are you really sure you know what the man page wants you to do?ft_strlcat()
– are you really sure you know what the man page wants you to do?ft_split()
– this function is just very, very hard (compared to the others). Acknowledge that, and take your time ;)ft_strmapi()
/ ft_striteri()
– well, make sure you know how to use function pointers ;)
Not so much here, as the subject matter is comparatively clear about the task at hand. However:#Cleaning Up
ft_strlcat()
return? And how many bytes does it append? Is it always NULL
-terminating your string?malloc
inside your ft_split
fails? Are you freeing all of previously allocated splits?
Are your evals over and Moulinette let you through? Congrats! :) Let's make sure you memorize stuff you'll need for the future. Some tasks for you: And because I don't want to be mean – here is the header code:#Aftercare
ft_strcmp(char *s1, char *s2)
ft_c_isin_str(char c, char *str)
– yes, you can also just use ft_strchr
for that in a hacky way.ft_str_isin_strs(char *needle, char **needle-box)
int ft_strcmp(char *s1, char *s2);
int ft_c_isin_str(char c, char *str);
int ft_str_isin_strs(char *needle, char **box_of_needles);