You managed to explain in 17min what my teacher couldn't in 7 hours. thank you so much. I needed this for my project and couldn't continue without it, had been stuck on it for a whole week. aboslute grade saver
@kacpergnys71662 жыл бұрын
Dude I am doing a project for uni where one of the functions I need to write needs to do this. Been sitting on it for a whole day getting seg faults and this has finally worked. You are an absolute legend
@PortfolioCourses2 жыл бұрын
That's awesome I'm so glad to hear it helped you out Kacper! 😀
@Dragon-Slay3r2 жыл бұрын
@@PortfolioCourses kaCper you mean
@PortfolioCourses2 жыл бұрын
@@Dragon-Slay3r Hahahahaha!
@Dragon-Slay3r2 жыл бұрын
@@PortfolioCourses you seen? Lol
@PortfolioCourses2 жыл бұрын
@@Dragon-Slay3r Haha yup! 🙂
@natevaub2 жыл бұрын
Thank you for the amazing explanation. Recreating existing function is a very good exercice but sometime difficult and you help me a lot.
@PortfolioCourses2 жыл бұрын
You're welcome Nathan! :-)
@VoidExistence2 жыл бұрын
Sir you are a king for this 👑 Segfault almost ended my existence. Subbed!
@PortfolioCourses2 жыл бұрын
Haha thank you I'm glad it helped you! 🙂 And welcome aboard!
@EliskaM-q1z Жыл бұрын
You are amazing, love your videos it is so well explained!! Every time I am looking for some functions I go straight to your videos :) Thank you for your time doing that!
@PortfolioCourses Жыл бұрын
You’re very welcome, I’m glad you enjoy them! :-)
@KeyboardSound1 Жыл бұрын
Thank you. This is exactly what i needed. Your explanations are among the best if not the best on the subject of c programming.
@PortfolioCourses Жыл бұрын
You’re welcome, I’m glad the video was helpful for you! :-) And thank you for the kind feedback too!
@thedapperfoxtrot8 ай бұрын
Is there any issue with the fact that you're not checking for the success of malloc in the case of the array, and the arrays within the array? Like yes, you free it after in the main function, but what if somehow there's a failure during one of the substring allocations? Many colleagues have been telling me that I should the run a helper function that will free each allocated substring and the array containing them, and return 0. Thoughts on this? Out of the scope of this video?
@tii042 жыл бұрын
Thank you so much for this explanation!!!
@PortfolioCourses2 жыл бұрын
You’re very welcome Tiisetso! :-)
@yogeshchauhan9401 Жыл бұрын
Is this similar to strtok function?
@PortfolioCourses Жыл бұрын
Yes a bit similar Yogesh in that they both involve breaking a string into smaller pieces based on delimiters... though notably this function is using dynamic memory allocation to give back an array of new strings on the heap, where as strtok() does not do this. :-)
@yechezkelyirmaha5727 Жыл бұрын
Love it, but why do you use a int pointer instead of just the count as an int
@nohaelhassan6724 Жыл бұрын
Thank you for the clear explanation! 🙌🏽❤️ My question is, can we use the free function in our created split function instead of main?
@PortfolioCourses Жыл бұрын
I'm glad you enjoyed the explanation! :-) The issue with that is that it would free the memory for the strings when we may still want to use it.
@ManOwaRR1 Жыл бұрын
hi , is there anything similiar to that but for stl vector ? , thanks . great videos thanks for everytthing .
@PortfolioCourses Жыл бұрын
You're welcome Elie I'm glad you enjoyed the video! :-) I don't have a video on that topic unfortunately, but maybe something else online could help like this: www.geeksforgeeks.org/slicing-a-vector-in-c/
@ManOwaRR1 Жыл бұрын
thank you , i have been trying to focus on what aspect , and master it and i choose std::vector , instead of std::array and c style array , learning the 3 of them for us beginners , becomes really confusing , and almost everyone appreciate and loves vectors as a contains , hopefully i made the right decision :) , thank you.
@PortfolioCourses Жыл бұрын
I think it's a good idea to start with one concept at a time, but in programming we're often stuck learning a lot of things anyways. :-)
@ManOwaRR1 Жыл бұрын
@@PortfolioCourses , yes thank you trying my best and still everything sounds confusing , some things logically should work , and they dont..., programing is very confusing in the begining :)
@PortfolioCourses Жыл бұрын
I agree. :-)
@alexantollin564 Жыл бұрын
how to modify this code in order to split string with sub-string not by characters , for example "The splitter quick fox splitter jumps splitter over the splitter lazy dog". I want split the string with the sub-string "splitter". Thank you in advance.
@PortfolioCourses Жыл бұрын
That’s a different problem maybe one day I can do a video on that topic. :-)
@xoppi10922 жыл бұрын
this is own strtok() ?
@PortfolioCourses2 жыл бұрын
A little bit like strtok(), but it's more like .split() in JavaScript or Python. :-)
@kingsleyokon76442 жыл бұрын
I want to create a function that joins an array of strings on a separator characters, can i use this split function???
@PortfolioCourses2 жыл бұрын
If you want to join an array of strings I think this video on creating a join function might help you more: kzbin.info/www/bejne/sKauoomKl66Lhas. Good luck Kingsley! :-)
@kingsleyokon76442 жыл бұрын
@@PortfolioCourses Thanks I was able to solve my_join function. I have another task to create my_square using C language. Is there any project or resources that can be of help? Thanks
@animedeathfire17242 жыл бұрын
You could have passed a pointer to a struct of char * and size_t