Dynamic Memory with Malloc - Everything you Need to Know

Sdílet
Vložit
  • čas přidán 29. 08. 2024

Komentáře • 11

  • @codebreakthrough
    @codebreakthrough  Před rokem

    🌟Be notified of new C/C++ course: calcur.tech/c-cpp-newsletter

  • @byskawica1919
    @byskawica1919 Před měsícem

    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.”

  • @Dulge
    @Dulge Před rokem +2

    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.

  • @ElementResources-rp8ox
    @ElementResources-rp8ox Před 10 měsíci +1

    Really nice examples in this video...well done and thank you!

  • @goaheadskinit
    @goaheadskinit Před 7 měsíci

    Thank you for your explanation. Really helpful.

  • @m4daruba309
    @m4daruba309 Před 3 měsíci

    Thank you very much. Very helpful.

  • @andrewcomtois6542
    @andrewcomtois6542 Před 6 měsíci

    very helpful

  • @TheBuilder
    @TheBuilder Před rokem

    good job

  • @kermitdafrog8
    @kermitdafrog8 Před rokem

    Do you use calloc at all?

  • @typingcat
    @typingcat Před rokem

    Dang, 8 years changes the voice and the face. Unrecognisable. (I came from a 8-year-old database video).

  • @reenamola2162
    @reenamola2162 Před rokem +1

    first