Quick notes is that this memory is allocated on rhe heap and the heap is much slower than the stack where your local variables and data is stored. Using dynamic memory is powerful when we working with huge classes or structs or when we need our data to have a longer lifetime even when out of scope. Its also very useful when we need to have a buffer for the user input.
🌟Be notified of new C/C++ course: calcur.tech/c-cpp-newsletter
Quick notes is that this memory is allocated on rhe heap and the heap is much slower than the stack where your local variables and data is stored. Using dynamic memory is powerful when we working with huge classes or structs or when we need our data to have a longer lifetime even when out of scope. Its also very useful when we need to have a buffer for the user input.
You could also use this altogether :
”
int* x = malloc(sizeof(int) *4);
*(x + n) = y; // n is the list index and y is the assigned value.”
Really nice examples in this video...well done and thank you!
Thanks u very helpfull and clearly lesson
Thank you for your explanation. Really helpful.
Thank you very much. Very helpful.
helped me alot. thanks.
now i have the idea to make dynamic lists like cpp vectors in c
good job
very helpful
Do you use calloc at all?
good
Dang, 8 years changes the voice and the face. Unrecognisable. (I came from a 8-year-old database video).
first