ft_substr
Subject
Understandable explanation
ft_substr
returns a substring of the string s
passed as parameter.
Here's an example
Hints
First we have to check if the start
index is greater than the length of the string or not.
We also have to check if the start
plus the len
is greater than the length of the whole string.
Then we allocate enough memory for the substring, and copy from s[start]
until we reach len
characters copied into our new string.
And finally we can return the substring.
Commented solution
Last updated