Split Strings Function | C Programming Example

  Рет қаралды 27,104

Portfolio Courses

Portfolio Courses

Күн бұрын

Пікірлер: 40
@basi0016
@basi0016 Жыл бұрын
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
@kacpergnys7166
@kacpergnys7166 2 жыл бұрын
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
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
That's awesome I'm so glad to hear it helped you out Kacper! 😀
@Dragon-Slay3r
@Dragon-Slay3r 2 жыл бұрын
@@PortfolioCourses kaCper you mean
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
@@Dragon-Slay3r Hahahahaha!
@Dragon-Slay3r
@Dragon-Slay3r 2 жыл бұрын
@@PortfolioCourses you seen? Lol
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
@@Dragon-Slay3r Haha yup! 🙂
@natevaub
@natevaub 2 жыл бұрын
Thank you for the amazing explanation. Recreating existing function is a very good exercice but sometime difficult and you help me a lot.
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You're welcome Nathan! :-)
@VoidExistence
@VoidExistence 2 жыл бұрын
Sir you are a king for this 👑 Segfault almost ended my existence. Subbed!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Haha thank you I'm glad it helped you! 🙂 And welcome aboard!
@EliskaM-q1z
@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
@PortfolioCourses Жыл бұрын
You’re very welcome, I’m glad you enjoy them! :-)
@KeyboardSound1
@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
@PortfolioCourses Жыл бұрын
You’re welcome, I’m glad the video was helpful for you! :-) And thank you for the kind feedback too!
@thedapperfoxtrot
@thedapperfoxtrot 8 ай бұрын
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?
@tii04
@tii04 2 жыл бұрын
Thank you so much for this explanation!!!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You’re very welcome Tiisetso! :-)
@yogeshchauhan9401
@yogeshchauhan9401 Жыл бұрын
Is this similar to strtok function?
@PortfolioCourses
@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
@yechezkelyirmaha5727 Жыл бұрын
Love it, but why do you use a int pointer instead of just the count as an int
@nohaelhassan6724
@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
@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
@ManOwaRR1 Жыл бұрын
hi , is there anything similiar to that but for stl vector ? , thanks . great videos thanks for everytthing .
@PortfolioCourses
@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
@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
@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
@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
@PortfolioCourses Жыл бұрын
I agree. :-)
@alexantollin564
@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
@PortfolioCourses Жыл бұрын
That’s a different problem maybe one day I can do a video on that topic. :-)
@xoppi1092
@xoppi1092 2 жыл бұрын
this is own strtok() ?
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
A little bit like strtok(), but it's more like .split() in JavaScript or Python. :-)
@kingsleyokon7644
@kingsleyokon7644 2 жыл бұрын
I want to create a function that joins an array of strings on a separator characters, can i use this split function???
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
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! :-)
@kingsleyokon7644
@kingsleyokon7644 2 жыл бұрын
@@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
@animedeathfire1724
@animedeathfire1724 2 жыл бұрын
You could have passed a pointer to a struct of char * and size_t
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Yep, that's true. :-)
strtok() function | C Programming Tutorial
12:36
Portfolio Courses
Рет қаралды 66 М.
30+ String Manipulation Techniques in C#
1:44:07
IAmTimCorey
Рет қаралды 104 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
Dynamically Allocate Memory For An Array Of Strings | C Programming Example
12:10
How to split strings in C (strtok)
9:28
CodeVault
Рет қаралды 108 М.
Join Strings Function | C Programming Example
15:28
Portfolio Courses
Рет қаралды 3,5 М.
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 338 М.
String In Char Array VS. Pointer To String Literal | C Programming Tutorial
9:58
C++ Weekly - Ep 340 - Finally! A Simple String Split in C++!
8:41
C++ Weekly With Jason Turner
Рет қаралды 23 М.
why do void* pointers even exist?
8:17
Low Level
Рет қаралды 399 М.
Read And Write An Array Of Structs To A Binary File | C Programming Example
18:27
The Absolute Best Intro to Monads For Software Engineers
15:12
Studying With Alex
Рет қаралды 677 М.
Брат Лизоньки. Как его зовут?
0:48
Hanna11-тиктокер с 4 мультами
Рет қаралды 2,4 МЛН
Sorvete de Danoninho
0:57
Spider Slack
Рет қаралды 33 МЛН
ДОБРО БАБУШКЕ/ВЫЗВАЛИ ПОЛИЦИЮ #shorts
1:00
Леха Медведь
Рет қаралды 2,9 МЛН