The fact that you get excited talking about this concept really helps me to try to understand, it is a quality that great teachers have
@ultracycling_vik5 жыл бұрын
I must compliment your great explanations. You really can convey the complexities of the C Language in an understandle manner. I am surprised that your content is not ranked higher, because , at least in my opinion, you have produced the best tutorial series about C on KZbin. Thank you very much for your work!
@AKGamersLite3 жыл бұрын
I agree, I been watching all his C videos for past few months and have to say he explains it in such a simple and enjoyable manner. He explains the same concepts 1000 times better than my professors at university.
@anabrr2 жыл бұрын
I also agree. I just come to him every time I want to learn about a new C concept, because I know there is no better explanation than his
@system_ctl2 ай бұрын
So far, the best video for me at explaining how it actually work. I can't thank you enough. I really appreciate it. Thanks a million.💙
@Safwan.Hossain11 ай бұрын
This is by far the best Linked List series I've seen on KZbin specifically for C because you went over many quirks of C programming that I was confused about (like the deferencing NULL pointer warning given when you use malloc) as well as how pointers work play into creating Linked Lists
@thatianamoreira96369 ай бұрын
You're an excellent teacher! Thanks so much!!! I'm a brazilian Software Engineering student and your videos are helping me a lot!
@kapellimestari00783 жыл бұрын
I was trying to apply and understand linked lists fully about 3 weeks by now, and your videos are so clear and so so good, thank you very much
@turuus52152 жыл бұрын
This guy is an excellent teacher.
@michalbotor2 жыл бұрын
you're a brilliant teacher. you not only explain c in a remarkably easy to understand way, but also anticipate all the errors that a noobie will probably encounter. you introduced malloc, and of course i had a memory leak, because i forgot to call the free function. you introduced two mallocs, and of course i had a memory leak again, because i called free function twice, but in the wrong order. you introduced the insert_end function, and of course i had a segmentation fault, because i forgot that an empty linked list is an edge case. simply outstanding learning experience.
@Jarvx Жыл бұрын
One of the best C series of all time
@m4rcus4118 ай бұрын
Thank you a lot for these videos. You explain C very well
@fluffyweird Жыл бұрын
It took me about 3 days but you will get it just keep on rewriting the code and NEVER GIVE UP, and thank you sir for this amazing video
@fluffyweird Жыл бұрын
although I still don't understand the application of it I think linkedlists are something I should understand and play around
@CodeVault Жыл бұрын
You really have to look at time and memory complexities when talking about usefulness of linked lists. When adding at the beginning of an array, the operation is O(n) but when adding at the beginning of a linked list the operation is O(1). So, this is an advantage. If this operation is something that needs best performance in your program, then it's worth considering using (same applies with other operations, although for some the array is better) Another consideration is data. If you need the data to be stored sequentially then, of course, a simple array is good enough but, if you need it scattered around the memory, then a linked list is a good candidate (linked lists are what are used in databases to create the B-tree indexes)
@tonykososki30163 жыл бұрын
man i its the next video im watching from you and i must say you are very good at explaining things, i hope you gonna have more views soon and the channel will rise! good luck!
@puripatratanaarpa40662 жыл бұрын
I'm very confuse why we use double pointer points to the first node. Why don't we use the first node pointer directly?
@CodeVault2 жыл бұрын
Because, sometimes, we need to change the root node. Since the address to the root node is in the main function's stack memory, we have to have a pointer to that, otherwise modifying the root node won't modify it in the main function. Since the root node is a pointer to Node, to modify that we need a pointer to pointer to Node (the double pointer you're talking about)
@tbatana10 ай бұрын
Best gesticulation in C world! respect!
@szymonxf4 жыл бұрын
12:35 how did you commented all 5 rullers of code at one time? What buttons combination is this?
@CodeVault4 жыл бұрын
You can add a new cursor above/below the current one with Ctrl + Alt + UP(or DOWN) in VSCode. Note that you might have to change that shortcut as some graphics drivers default to it as well sometimes.
@Gowrilekshmi20214 жыл бұрын
Very good explantion best course for c program and linked list. I want to come back after one month and will see 100K subcribers
@joguitox1584 ай бұрын
Hi, i just have a month watching this serie of C and i was wondering if there is some way for instead of using another pointer to get the address of the root and assignee every node to that pointer, use the root Node directly?
@CodeVault4 ай бұрын
You mean to basically replace the double pointer with a single pointer in the insert_end function? You can, but, if the list is empty (which is denoted by the root being NULL) you can't add any elements to it. Changing that NULL pointer from the main function requires you to have a double pointer
@onaecO2 жыл бұрын
dear sir, at 11:25 why we cannot send the pointer to root directly ,but instead a **root?
@CodeVault2 жыл бұрын
Remember when I said that we consider an empty list (with no elements) to just have the root pointer be NULL. That means that, if there are no elements in the linked list we will have to change this pointer from NULL to something else. But since root is inside the main function and we want to change it from another function we need a pointer to THAT. A pointer to a pointer to a node, that's just a double pointer You can design the linked list in such a way that you don't need to pass a double pointer.
@h_ipon10 ай бұрын
im sorry but where exactly did the free function go since you used malloc? and thank you so much btw you made it way much easier for me to understand linked lists!!
@CodeVault9 ай бұрын
At a later video I explain how to dealloc the linked list: code-vault.net/lesson/ggiva1mn2n:1603732279985
@stephensagarinojr.4170 Жыл бұрын
ahhhhhhhhh. i'm just a beginner and double pointer is giving me a real hard time
@stephensagarinojr.4170 Жыл бұрын
it took me two days to understand the poinsters as a beginner, Finally now I understand it. Don't give up guys! just try to visualize if you're having a hard time to understand.
@CodeVault Жыл бұрын
There is this video I made about double pointers: code-vault.net/lesson/tapcyuvuo6:1603733527497
@sash11g6 күн бұрын
why do you use a double pointer and not just a single pointer and pass "root" instead of "&root", wouldnt it work just as fine?
@CodeVault2 күн бұрын
I did reply to this question multiple times here so I suggest you scroll in the comments for a more detailed explanation there. The gist of it is, if the list is empty, you have to have a way to set the root pointer from inside the main function. Since root is a pointer to node, to set that, from another function you need a pointer to it. Hence double pointer to Node.
@wassimboussebha25613 жыл бұрын
in insert function , why we can't do that directly without using the pointer curr ?
@CodeVault3 жыл бұрын
Well, you can, but you'd only be able to insert the element at the beginning of the list (not at the end)
@anabrr2 жыл бұрын
Your explanation is very very good, but still this isn't easy stuff!!
@campeanpetru-razvan99952 жыл бұрын
Amazing video , Thank You!!
@ruscyber97653 жыл бұрын
Can a memory leak (if I don't use free() in a simple program) cause a serious troubles with my computer such as: data corruption, or will games or other my projects work badly?
@CodeVault3 жыл бұрын
Nonono, usually the operating system takes care of freeing the memory after the program finishes its execution. But in a long running process, this can cause issues (for example, if there was a memory leak in a game then it might end up using up all the RAM available on the system)
@MalaikaMirza-t4n Жыл бұрын
Hi, why do you decide to use a pointer to a pointer in your insert_end function for the root. It seems like it would just add another step when trying to use root because you would have to always put * in front of it once?
@CodeVault Жыл бұрын
In case the linked list is empty. If it's empty we actually have to create the root node and, since the root pointer is in the main function, we need to change that. We need a pointer to the root pointer for that
@Safwan.Hossain11 ай бұрын
I think it is because if you do not use pointer to pointer (node**), then we are passing a node pointer (node*) by value instead of by reference, so the changes we make to `root` will not take place when we return to main, only done in the insert() function and lost.
@andyan6776 Жыл бұрын
Thanks a lot for the wonderful video! I am wondering why the program you write won’t have a memory leaks? Shouldn’t we free the new_node each time?
@CodeVault Жыл бұрын
Yes! That's what I cover in one of the next videos: code-vault.net/lesson/ggiva1mn2n:1603732279985
@andyan6776 Жыл бұрын
@@CodeVault thanks! But I couldn’t open this website.
@andyan6776 Жыл бұрын
@@CodeVault do you have the link for that video on KZbin?
@andyan6776 Жыл бұрын
@@CodeVault the website works! I think that might be my internet problem. I have watched that video and I am wondering what if I just remove several nodes from the linked list in a removed function, how do I free those several removed nodes?
@andyan6776 Жыл бұрын
@@CodeVault my current situation is: I got a linked list and set up using the way you teach in this video, and through the whole program, there is a function that will remove specific nodes from this linked list, so at the end of the program, when I free this linked list starting from the head, I won’t be able to free those specific nodes that had been removed from the linked list, so there is a memory leaks… I have thought about this for nearly 4 hours and couldn’t think about a solution for freeing those removed nodes…
@zimablue26643 жыл бұрын
I don't really understand why we need a "node** root", is a "node* root" also ok for this application?
@CodeVault3 жыл бұрын
The thing is, the pointer to the root node of the linked list is stored in the main function. (as a node*). This is fine for insertion, unless the list is empty. If it's empty, the pointer to the root node is NULL. So you'll need to modify that to be the added node that you want to insert. The thing is, that pointer is in the main function so, to change it you need a pointer to that pointer. Hence the double pointer (node**)
@captainpupz7271 Жыл бұрын
Thank you, you saved my life!!!
@Gamerssassin2 жыл бұрын
What an amazing video.
@MelondogEnjoyer4 жыл бұрын
Sorry i don't understand why you used a double pointer to the root to create a new list, i tried to use only a pointer and it works the same. I'm surely missing something.
@MelondogEnjoyer4 жыл бұрын
Well i tried it with better functions now and it doesnt work without double pointer, but i still don't understand why we need that
@CodeVault4 жыл бұрын
It's because we're changing the root itself if there are no elements in the list. And, since the root is a pointer inside main, we need something that points to that aka a pointer to that pointer, aka a double pointer.
@MelondogEnjoyer4 жыл бұрын
@@CodeVault ok, now i understand. Thanks!
@TommasoEsposito-j6u Жыл бұрын
why every programer has a shirt like yours
@medam90423 жыл бұрын
Arigato !
@pauloskalyvas15903 жыл бұрын
hi.... i am trying to add elements in a linked list in a fuction .... When i print the values into the fuction everything is fine... When i am trying to print them into the main i dont get nothing...why doesn't return when i am writing *mylst_ptr=tmp; ?? I created tmp just to keep the first node of list.... Can you please help me ? typedef struct nod{ int value; struct nod *next; }Node; typedef Node * List; void createList ( List *mylst_ptr, int elements){ Node *tmp=*mylst_ptr; for(int i=0;ivalue=rand()%50; curr->next=NULL; if ( (*mylst_ptr) == NULL ){ (*mylst_ptr)=curr; printf("%d ",(*mylst_ptr)->value); } else{ while ( (*mylst_ptr) != NULL ){ (*mylst_ptr) = (*mylst_ptr)->next; } (*mylst_ptr)=curr; printf("%d ",(*mylst_ptr)->value); } } *mylst_ptr=tmp; printf(" final=%d",(*mylst_ptr)->value); //// i get nothing here } int main () { Node *root=NULL; createList(&root,10); while (root!=NULL){ printf("%d ",root->value); root=root->next; } }
@pauloskalyvas15903 жыл бұрын
sorry for my English ...
@CodeVault3 жыл бұрын
Problem is with the double pointers you're using. First you have to change (*mylst_ptr) = (*mylst_ptr)->next; to mylst_ptr = &(*mylst_ptr)->next; since you want to have a double pointer to the next spot of that node. Then you also won't need the *mylst_ptr = tmp; since you set (*mylst_ptr) = curr; with curr being the first node.
@ib16644 жыл бұрын
Absolutely awesome explanation, can you also implement trees and binary trees