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_vik4 жыл бұрын
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
@Safwan.Hossain7 ай бұрын
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
@thatianamoreira96364 ай бұрын
You're an excellent teacher! Thanks so much!!! I'm a brazilian Software Engineering student and your videos are helping me a lot!
@kapellimestari00782 жыл бұрын
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
@m4rcus4113 ай бұрын
Thank you a lot for these videos. You explain C very well
@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
@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)
@turuus52152 жыл бұрын
This guy is an excellent teacher.
@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!
@tbatana6 ай бұрын
Best gesticulation in C world! respect!
@vambans24124 жыл бұрын
Very good explantion best course for c program and linked list. I want to come back after one month and will see 100K subcribers
@anabrr2 жыл бұрын
Your explanation is very very good, but still this isn't easy stuff!!
@campeanpetru-razvan9995 Жыл бұрын
Amazing video , Thank You!!
@captainpupz72719 ай бұрын
Thank you, you saved my life!!!
@h_ipon5 ай бұрын
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!!
@CodeVault5 ай бұрын
At a later video I explain how to dealloc the linked list: code-vault.net/lesson/ggiva1mn2n:1603732279985
@Gamerssassin2 жыл бұрын
What an amazing video.
@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)
@duarteponce4 Жыл бұрын
love u
@szymonxf3 жыл бұрын
12:35 how did you commented all 5 rullers of code at one time? What buttons combination is this?
@CodeVault3 жыл бұрын
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.
@Alex-uz3dq Жыл бұрын
thank u a lot
@luandkg4 жыл бұрын
Great !
@ib16644 жыл бұрын
Absolutely awesome explanation, can you also implement trees and binary trees
@CodeVault4 жыл бұрын
Sure thing. It's already in the planning stage ;)
@ukaszkiepas56053 жыл бұрын
thanks
@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
@medam90423 жыл бұрын
Arigato !
@whatever62233 жыл бұрын
Why not simply pass the root pointer by value? It will still point to the same place in memory. Am I missing something?
@CodeVault3 жыл бұрын
I explain at the end of the video. If the list is empty then *root is NULL, which needs to be set to the new node that is being inserted. So the root does change in some cases
@whatever62233 жыл бұрын
@@CodeVault I see. Thank you very much for the explanation. You've got an excellent channel!
@ruscyber97652 жыл бұрын
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?
@CodeVault2 жыл бұрын
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)
@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…
@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)
@user-hs5ge6mn1v10 ай бұрын
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?
@CodeVault10 ай бұрын
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.Hossain7 ай бұрын
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.
@onaecO Жыл бұрын
dear sir, at 11:25 why we cannot send the pointer to root directly ,but instead a **root?
@CodeVault Жыл бұрын
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.
@zimablue26642 жыл бұрын
I don't really understand why we need a "node** root", is a "node* root" also ok for this application?
@CodeVault2 жыл бұрын
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**)
@user-wz1tm5dg8y9 ай бұрын
why every programer has a shirt like yours
@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.
@sup3rs5663 жыл бұрын
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.
@sup3rs5663 жыл бұрын
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
@CodeVault3 жыл бұрын
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.