Комментарии:
Excellent explanation
Ответитьperfect video
Ответитьwhy did u stop posting ? 😥
ОтветитьDude is a GOAT. As a grad student taking a CS class (non cs major) this has made it extremely clear how to allocate dynamic memory. Thanks!
ОтветитьVery informative 🔥
ОтветитьI know I'm a bit late to the party but goddammit that explanation is so good. pleace don't stop doings vids like this you've made a difference in someone's life
Ответитьthis is the one
ОтветитьNice explanation! However there's an optimized way to allocate a 2d array
int **p = (int **)malloc(rows * sizeof(int *));
p[0] = (int )malloc(rows columns * sizeof(int));
for (i = 1; i < rows; i++) {
p[i] = p[i – 1] + columns;
}
free(p[0]);
free(p);
In this case, a single block of memory is allocated and rearrange the pointers to form an array. This is computationally better for a few reasons:
1. The allocation engine does not perform as many allocations as before.
2. As opposed to the conventional implementation, there's no extra bytes between rows to keep count of the memory blocks. That means the final 2d array is represented in a continuous memory block. Therefore, there's no need to make large moves between those positions in the memory.
3. free() is called twice only. The conventional implementation depends on the 'rows' size.
This is a life saver. Thank you!
Ответитьexactly what I needed :) I'm working on a small project that solves a system of user input equations and this is the core of it
ОтветитьWow ! Great explanation, i'm french and your english is very understandable ! Thanks a lot !
ОтветитьAmazing explanation way more clear than my college professors
ОтветитьThis has been the most easy -to-understand tutorial ever since. Thanks a lot.
Just a little something : on function free2dIntArray() we shouldn't include the third parameter dim2 on the function's prototype.
Thank you, this was an approachable explanation that helped me finally understand the concepts.
ОтветитьVery good explanation sir it's a superb video. Everyone can understand this concept without any doubt.
Ответитьplease you are amazing , thnks a lot and you have made my difficulties become simple for me 💯🙏🙏
Ответитьthank you for the effort creating this wonderful video
ОтветитьB E A U T I F U L EXPLANATION
Ответитьbest explanation , keep it going !
Ответитьwhy is (int**) debatable? is there something wrong with using it? thanks!
Ответитьmake more videos please
Ответитьthanks a lot that was quite helpful.
ОтветитьI feel like I don't need to know this for the problem set I'm doing, but this was very helpful regardless. Thank you!
Ответитьlegend
ОтветитьCan you please make complete knowledge of c/cpp, You are way of teaching so good and you really get us into deep which really i want !!
Thanks for this video 🤠
this video is so good!Thanks!
Ответитьyou're a fuckin lifesaver, man
Ответитьi love this
ОтветитьIt would have been nicer if you give meaningful names to parameters like instead of Dim1 Dim2 you can could have written Row and col, in video you are mentioning them as row and col why not name them the same.
Ответитьthank you sir!
ОтветитьI went in with no expectation, I finished with complete understanding of what I should be doing, and also a slightly better idea on pointers/array. Thanks a bunch, appreciate your work greatly.
ОтветитьThis was gem
ОтветитьClearly understood! Thank you sir.🙇
ОтветитьBest video on this topic !! Thanks alot.
ОтветитьThank you very much for this wonderful content.
Ответитьthank you sir.
ОтветитьActually the true dynamic 2d array can be allocated with a pointer to array. Just do `int (*arr)[dim2] = calloc(dim1, sizeof *arr);`. And that's all. Just remember to call `free(arr)` at the end.
ОтветитьStrictly speaking isn't this a lookup table not a true contiguously allocated 2d array?
ОтветитьYou're the best
ОтветитьCan you please make a video about dynamic allocation for array of strings please
ОтветитьI finally understood why it works like that thanks to you :)
Just got a question, in the freeing part (the correct one) wouldn't it be the same if I didn't pass dim2 as a parameter, since it's not needed for deallocating the memory?
amazing explanation!! Thanks alot really
ОтветитьFinally some good explanation about 2D dynami array! Piece of gem! Thank you!
Ответитьthanks bro!
ОтветитьVery well explained , I'm glad I found your channel !
ОтветитьJust like professor Feynman said if you understand something well enough you’ll be able to explain it in the most simplest way.and that’s exactly you’ve done. Thank you for making this difficult topic understandable!!!
Ответитьgreat video
Ответить