Dynamic memory allocation in C - malloc calloc realloc free

See complete series on pointers here:
• Pointers in C/C++
In this lesson, we will be discussing the use of library functions in C for dynamic memory allocation and deallocation. These functions are malloc, calloc, realloc and free.
Feel free to drop your comments, feedback and suggestions.
For practice problems and more, visit: www.mycodeschool.com
Like us on Facebook: / mycodeschool
Follow us on twitter: / mycodeschool

Пікірлер: 540

  • @aydinlenma2416
    @aydinlenma2416 Жыл бұрын

    Almost 10 years and still this is the only video that made me understand dynamic memory allocation in c

  • @yosoyfantastico

    @yosoyfantastico

    4 ай бұрын

    he dead

  • @aburridohp
    @aburridohp9 жыл бұрын

    Sir. Thanks for this video. I am a Computer Science student from USA, and the only thing I can say is that my professor should be watching this video also. You saved me to complete my assingment, but the most important thing is that I finally learned the topic which is more important to me. Greetings from Miami. Best Regards

  • @mycodeschool

    @mycodeschool

    9 жыл бұрын

    aburridohp You are most welcome :)

  • @srix01

    @srix01

    8 жыл бұрын

    +mycodeschool really awesome for beginners also

  • @masbro1901

    @masbro1901

    8 жыл бұрын

    +aburridohp me too, this video help me a lot. i'am also a computer science student, regards from indonesia.

  • @theamjolnir9641

    @theamjolnir9641

    6 жыл бұрын

    This so much!

  • @jiteshsharma4692

    @jiteshsharma4692

    5 жыл бұрын

    mycodeschool ....awesome video... This video is much much better than other local books.. And college teachers/ professors .....thank you mycodeschool

  • @ankitgupta8797
    @ankitgupta87976 жыл бұрын

    You are actually explaining the most complex things in the simplest way. I think every book on C should contain a reference to your videos.

  • @randomvideos5407
    @randomvideos54073 жыл бұрын

    learning is so fun when you learn it from the right people

  • @jenilsoni3527
    @jenilsoni35275 жыл бұрын

    He malloc, He calloc, but most importantly... He realloc to 0.

  • @aquibjavedrollnumber1763

    @aquibjavedrollnumber1763

    3 жыл бұрын

    I read zeroc

  • @ajiriospepperspot624

    @ajiriospepperspot624

    3 жыл бұрын

    ciroc

  • @tapionevalainen6776
    @tapionevalainen67765 жыл бұрын

    I have watched a fair amount of tutorials in a wide range of topics over the years. This series has to be, hands down, the best one there is. Amazing job dude, I sincerely hope you are a teacher because you are the natural talent.

  • @nakarelka
    @nakarelka9 жыл бұрын

    Thank you very much for all your videos. I really feel like my teacher should learn from you, it's amazing how you can, in 17 minutes, explain something she's trying to explain in 3 hours. And she fails every time. Too bad I haven't found your videos earlier! :)

  • @mycodeschool

    @mycodeschool

    9 жыл бұрын

    Thanks a lot Natália Karelová

  • @nixondutta8192

    @nixondutta8192

    8 жыл бұрын

    sir same compliments from me too. it's a shame i didn't find your videos earlier.

  • @darkrayc

    @darkrayc

    8 жыл бұрын

    Wow I wish I found these at least a few months ago... then my assignments would have been a piece of cake. :'(

  • @utsavprabhakar5072

    @utsavprabhakar5072

    7 жыл бұрын

    feel absolutely the same thing. I could have passed my mid-sem examinations had I had access to these videos earlier :3 thanks a lot :D

  • @prakharkumar7368

    @prakharkumar7368

    6 жыл бұрын

    Natália Karelová

  • @daevyd100
    @daevyd10010 жыл бұрын

    Your whole series on pointers in C is an absolute goldmine!

  • @Capt_Saicin
    @Capt_Saicin6 жыл бұрын

    Man I am actually really impressed with this explanation usually I find KZread tutorials for coding super convoluted, but this one was very clear and precise. Good job

  • @latias9628
    @latias96283 жыл бұрын

    I just wanted to say thank you! I'm relearning some stuff I'm rusty on for my new job and I appreciate greatly the fact that you share all of this knowledge for free for us.

  • @praxisdev1884
    @praxisdev18847 жыл бұрын

    You've made the topics of pointers and dynamic memory allocation crystal clear for me. You're a rockstar. Thank you.

  • @jacobgriner9569
    @jacobgriner95696 жыл бұрын

    I love your videos!!! My teacher from palm beach state college doesn't explain nearly as well as you and I'm so lucky to have found your vids. You're a life saver. I'm gonna spread the word so that more people can know about your vids when they are confused in C. Greetings from Boca Raton, Florida.

  • @namanshah2688
    @namanshah26882 жыл бұрын

    after so many failed attempts to learn basic programmng from different platforms now i can certainly say this is one of the best platforms to learn basics thanks to entire team for making such an amazing series .

  • @thestarinthesky_
    @thestarinthesky_4 жыл бұрын

    You are by far the MOST amazing teacher in KZread! Thank you so much. I wish you could get back here soon. We, cs students, really really need your knowledge!

  • @SnehaVernekar
    @SnehaVernekar8 жыл бұрын

    thanks a lot ! after 3 yrs in engineering now i am understanding the basic concepts being in final year !

  • @tripleh5825

    @tripleh5825

    8 жыл бұрын

    +Sneha Vernekar Your comment makes me feel a lot luckier as I am still in my second year and sir has saved me the effort

  • @SnehaVernekar

    @SnehaVernekar

    8 жыл бұрын

    Triple H nice :) make the best use of these videos ! get the concepts cleared right from the beginning :)

  • @tripleh5825

    @tripleh5825

    8 жыл бұрын

    +Sneha Vernekar Sure. Your words mean a lot coming from an experience senior :)

  • @StockStalker.

    @StockStalker.

    4 жыл бұрын

    I am a 3rd semester student and i think i have come to right place

  • @Anonymous-mz9un

    @Anonymous-mz9un

    3 жыл бұрын

    And your comment makes me feel bad coz I'm a s/w engineer and still unclear about the subject.

  • @SleetDrops
    @SleetDrops5 жыл бұрын

    I have learned much more from cramming to your videos in 4 hours than my university prof's teachings that stretch over months. sir mycodeschool, you is the realest

  • @rachanacitc
    @rachanacitc7 жыл бұрын

    SO FAR, ONE OF THE BEST EXPLANATIONS OF DYNAMIC MEMORY. MY CONCEPTS ARE TOTALLY CLEAR, ALL THANKS TO YOU :) WE USUALLY SHY AWAY OR RATHER FEAR DYNAMIC MEMORY ALLOCATION, BUT AFTER WATCHING THIS VIDEO, MY PERCEPTION HAS SURELY CHANGED.

  • @truck.-kun.
    @truck.-kun.4 ай бұрын

    I've never felt this clear in C. You are amazing

  • @YorozuyaNeesan2010
    @YorozuyaNeesan20107 жыл бұрын

    Watching your videos is an excellent accompaniment to reading my textbook, which is sometimes so unclear, I could cry lol. Thank you so much!

  • @terrykoontz347
    @terrykoontz3477 жыл бұрын

    One of the best teacher ever. Thanks for sharing your knowledge!

  • @ChildofDestiny22
    @ChildofDestiny227 жыл бұрын

    Simple, detailed, no bullshit explanation, i wish every teacher in my university is like you. THANKS ALOT!!

  • @coffle1
    @coffle19 жыл бұрын

    Great video ! C was my first programming language, and when I was first learning it I had no idea how to use malloc, calloc, and realloc, and just ended up never learning it lol. Thankfully when I decided to try and learn exactly what these functions do, your video was able to provide an easy to understand explanation.

  • @zephyr.huseynov
    @zephyr.huseynov2 жыл бұрын

    The best explanation i have ever seen.. Greeting from Azerbaijan 🇦🇿

  • @arvindramanathan329
    @arvindramanathan3292 жыл бұрын

    This channel is the best that I have found on these topics, thanks for sharing this. Again it proves the subject is not complex it is the way it is explained that makes it complex.

  • @yuanwang9896
    @yuanwang98963 жыл бұрын

    Thanks so much. I am a new grad to CS major and I just learn "coding" in python, matlab before in kinda math major. What we learnt about C in math major is so similar to learning python, just in another syntax, but actually they are so different! This series saved my life and really let me know deeper in C. Thanks again!

  • @yoitsrob
    @yoitsrob6 жыл бұрын

    Great video, this is by far the best tutorial i have found on line after hours of reading articles and watching videos

  • @zzzweasel
    @zzzweasel5 жыл бұрын

    this was extremely clear and helpful, thank you!

  • @alexlapena
    @alexlapena8 жыл бұрын

    I love this guy.

  • @poggly
    @poggly5 жыл бұрын

    this is a great video- i was hesitant at first because the videos on this topic were long but it's very concise and explains everything with specific examples

  • @karinafran9463
    @karinafran94636 жыл бұрын

    Thank you for making this video! It honestly helped me so much. You're a great teacher!

  • @vishalmaheshwari5088
    @vishalmaheshwari50887 жыл бұрын

    Great explanation!! You really make things a cakewalk. Thanks!!

  • @kiranmathews1953
    @kiranmathews19536 жыл бұрын

    The information inside those 17 videos is the minimum requirement for any programmer. Good job.

  • @DHRUVNARAYANSINGH
    @DHRUVNARAYANSINGH9 жыл бұрын

    Sir ,thank you for providing best programming video for free !

  • @lucasa8710
    @lucasa87102 жыл бұрын

    9 year later, and it the most helpful channel on this topic, great work

  • @MultiSapMan
    @MultiSapMan10 жыл бұрын

    Amazing video. Outstanding explanation. Thanks a whole bunch mate.

  • @riyadunnabi
    @riyadunnabi4 ай бұрын

    this is the only video that made me understand dynamic memory allocation in c

  • @urieltzuberi9885
    @urieltzuberi98852 жыл бұрын

    Thanks man, that actually showed me what malloc is. I had so much trouble and you made it easy, thank you so much

  • @andreamarchisio9608
    @andreamarchisio96087 жыл бұрын

    Thanks man! Most of ICT teachers should learn to explain as you do

  • @vivekmuralidharan4913
    @vivekmuralidharan49139 жыл бұрын

    Wonderful explanations!!!Dynamic memory allocation made easy by you!! Thanks a lot!!

  • @efodela4u
    @efodela4u11 жыл бұрын

    Awesome video, you explained this to me like no one would ever have.. thanks .

  • @ankajkumar595
    @ankajkumar5955 жыл бұрын

    Brilliant sir! After watching this video I found myself comfortable with dynamic memory allocation......

  • @senaustun4380
    @senaustun43802 жыл бұрын

    even videos with my native language couldn't explain it this well thank you :D

  • @tannermiller5412
    @tannermiller54125 жыл бұрын

    I am about 5 years late to the party but this video was amazing at explaining these dynamic memory allocation functions, much much better than my prof ever could. Thank you!!

  • @winsonlcc1562
    @winsonlcc1562 Жыл бұрын

    This is great video, clear my doubt! Superb explanation and sample code. Greetings from Malaysia

  • @NO-1-U-NO
    @NO-1-U-NO5 жыл бұрын

    🙂👍 You sir have helped a lot of Students, including me, better Understand the Dynamic Memory Allocation. Thank You!

  • @RishabhJain-iz5xk
    @RishabhJain-iz5xk4 жыл бұрын

    Bruhh you explained this concept like a pro...i almost cried:D

  • @TrevDevSwag
    @TrevDevSwag10 жыл бұрын

    Thank you bro! This video help me a lot! I didn't understand nothing from my C professor. :) Respect!

  • @pruthvigowda7950
    @pruthvigowda79509 жыл бұрын

    Thank you, great way of teaching :)

  • @noordamnick
    @noordamnick5 жыл бұрын

    great video, I finally understand these concepts.

  • @pfkong6917
    @pfkong69178 жыл бұрын

    what an amazing video you made ,it really helped me a lot ! you do a great job !

  • @evadethomas8223
    @evadethomas8223 Жыл бұрын

    Bro I appreciate you so much. Saved me for this midterm I'm about to take tomorrow.

  • @johnbritolima
    @johnbritolima7 жыл бұрын

    Very clear & hepful. Thumbs Up!

  • @LifeWithGod99
    @LifeWithGod9910 жыл бұрын

    Sir, thank you for your kind explanation, you have some really good didactic skills, congratulations!

  • @roykimor
    @roykimor9 жыл бұрын

    @mycodeschool your videos are amazing good job

  • @Javii96
    @Javii966 жыл бұрын

    Thank you for clarifying this for me, I already knew how to do this, and i've been doing it in school, but now it makes more sense.!

  • @rajeshbiswas755
    @rajeshbiswas7556 жыл бұрын

    this video is seriously very helpful.thank you very much

  • @shiftgrifts
    @shiftgrifts10 жыл бұрын

    Really helpful and concise! Thank you very much!

  • @Itskfx
    @Itskfx2 жыл бұрын

    I was having a lot of difficulty in understanding DMA but this cleared it up. Thanks!

  • @d48294
    @d4829410 жыл бұрын

    very well explained .thank you

  • @omondioliech
    @omondioliech Жыл бұрын

    I love this, the topic is widely explained. Thank you very much Sir.

  • @lucasf.v.n.4197
    @lucasf.v.n.41972 жыл бұрын

    The example at minute 10 is just what I was looking for, thx

  • @jejwjs8700
    @jejwjs87002 жыл бұрын

    A very helpfull video, you teach better than all my professors.

  • @iankury
    @iankury5 жыл бұрын

    Your videos are very helpful, thank you very much!

  • @alanye7542
    @alanye75422 жыл бұрын

    Thank you! Very well explained!!!

  • @SazzadHossain-su1vb
    @SazzadHossain-su1vb5 жыл бұрын

    Why some people dislike this kind of educational content. Thanks bro it helps me a lot.

  • @LavanshuSeth
    @LavanshuSeth8 жыл бұрын

    I had that "not so obvious question" for a long time. Even my teacher had no clue how that happened when I asked her. Well, now I know it. Thanks a lot. :)

  • @sabertoothlei
    @sabertoothlei4 жыл бұрын

    Very beautifully explained !!

  • @NiravPatel1989
    @NiravPatel198910 жыл бұрын

    Perfect explanation Thank you

  • @boisbois2947
    @boisbois29473 жыл бұрын

    You literally saved my life!

  • @little_techie_homemaker
    @little_techie_homemaker2 жыл бұрын

    Very helpful..Detailed session!!

  • @commandprompt7171
    @commandprompt71713 жыл бұрын

    this was exactly what i was looking for, thanks a lot

  • @AakarshDarla
    @AakarshDarla7 жыл бұрын

    at 9:55 it's perfectly fine to declare A[n] as an integer array , works perfect in my codeblocks compiler !

  • @adityachawla2163

    @adityachawla2163

    7 жыл бұрын

    Really? never heard of that before. I don't even believe that smh

  • @puturavindrawiguna3025

    @puturavindrawiguna3025

    3 жыл бұрын

    Yes, indeed sir, I was thinking the same thing. Like I've written codes that uses a variable to declare the size of an array, and it works fine. So, I am guessing this is more of a compiler thing? rather than the C language itself? Like in some compiler you cant do that, and in other, we can.

  • @gamoholic7653

    @gamoholic7653

    3 жыл бұрын

    @@puturavindrawiguna3025 I guess it's legal in C++ but I never tried in C. Can you please try and share the observations with me...

  • @adityavikramsinha408

    @adityavikramsinha408

    2 жыл бұрын

    @@gamoholic7653 I program in c++, I don't think it's legal, everytime I use an integer to initialize size of array, it flashes illegal initialization error, size cannot be vector value

  • @123akash121

    @123akash121

    2 жыл бұрын

    it wasnt orignally a part of c, its called variable length array (VLA), VLA has been there since C99 and has been optional since C11, however big compilers like clang or gcc will never remove it probably

  • @sword013
    @sword0134 жыл бұрын

    Such a smooth explanation, wow

  • @realmosscarlt
    @realmosscarlt Жыл бұрын

    Amazing demonstration.

  • @Yasory
    @Yasory9 жыл бұрын

    I finally know how to dynamically allocate memory...And two nights before my exam! thank you so much!!

  • @sachinjamdar3923
    @sachinjamdar39235 жыл бұрын

    sir thank you so much for this video.before i watch this video i had fear of pointer now i am feel good in pointer .your teaching technique is too good .

  • @ozzyfromspace
    @ozzyfromspace5 жыл бұрын

    To be clear, realloc() is a god-tier function 😂. Awesome explanation, you're A1, brother!

  • @PrSp00
    @PrSp008 жыл бұрын

    Great explanation...keep up the good work!

  • @feranmioladipo
    @feranmioladipo Жыл бұрын

    My code school is so awesome ❤❤

  • @user-tl5qy4yu5p
    @user-tl5qy4yu5p6 жыл бұрын

    this video is great! your explanation is so clear and helped me a lot ! tnx!!

  • @leoniemeiners5211
    @leoniemeiners52117 жыл бұрын

    This is simply great! Thank you

  • @achalgoel4844
    @achalgoel48449 жыл бұрын

    Simple Short & Crisp....You are awesome dude :)

  • @srix01
    @srix018 жыл бұрын

    Beautifully explained!

  • @dariodottorini7970
    @dariodottorini79705 жыл бұрын

    Very clear explanation, thank you!

  • @solamanranjit9478
    @solamanranjit947810 жыл бұрын

    Nice tutorial. Helped me a lot. thank you.

  • @hocvienitcu
    @hocvienitcu4 жыл бұрын

    I love your explanation, keep it up ...

  • @fountain9886
    @fountain98864 ай бұрын

    love you man, whereever are, thank you alot. it made clear.

  • @MujtabaNowshad
    @MujtabaNowshad11 жыл бұрын

    best Malloc tutorial on KZread

  • @PranKrishnaDas
    @PranKrishnaDas8 жыл бұрын

    Thank you for such a clear explanation.

  • @C1oolBoy123456
    @C1oolBoy1234568 жыл бұрын

    Excellent presentation. Thank you.

  • @AzeemHashmani
    @AzeemHashmani10 жыл бұрын

    Hey Mate, Thnks a ton!!! U xplained Memory Allocation v well !!!!

  • @samarpanrai5924
    @samarpanrai59242 жыл бұрын

    Finally after 2 years I can say that I know about dynamic memory allocation.

  • @beneelohimhub
    @beneelohimhub Жыл бұрын

    Thank you so much, I now practically understand dynamic memory allocation

  • @ahmedraafatibrahim
    @ahmedraafatibrahim6 жыл бұрын

    Well Explained .. Thank you!

  • @alireza2974
    @alireza29742 жыл бұрын

    thanks for the videos and I hope this will continue

  • @nishavprasad5906
    @nishavprasad59069 жыл бұрын

    loved it... thanks a ton for this valuable teaching

  • @BarakaAndrew
    @BarakaAndrew9 жыл бұрын

    This guy is awesome...!! Finally i understood this n can use it well in my assignments... Thanks alot!!! My professor is so boring!!

  • @devendramishra4197
    @devendramishra41975 жыл бұрын

    I think i could have paid my college fee to you for this teaching ...u are awesome ..My college professor's should see these video to learn actual c/c++...and companies are hoping from us to be a good programmer without such a good depth knowledge..

  • @Miminyte500
    @Miminyte5009 жыл бұрын

    Thank you very much! This helped me a lot.

  • @brutalbro3868
    @brutalbro38684 жыл бұрын

    It really helps me BROTHER THANK YOU SO MUCH