Stack vs Heap Memory in C++

  Рет қаралды 567,994

The Cherno

The Cherno

Күн бұрын

Patreon ► / thecherno
Twitter ► / thecherno
Instagram ► / thecherno
Discord ► thecherno.com/...
Series Playlist ► thecherno.com/cpp
malloc links:
gee.cs.oswego.e...
people.freebsd...
Thank you to the following Patreon supporters:
- Dominic Pace
- Kevin Gregory Agwaze
- Sébastien Bervoets
- Tobias Humig
- Peter Siegmund
- Kerem Demirer
Gear I use:
-----------------
BEST laptop for programming! ► geni.us/pakTES
My FAVOURITE keyboard for programming! ► geni.us/zNhB
FAVOURITE monitors for programming! ► geni.us/Ig6KBq
MAIN Camera ► geni.us/t6xyDRO
MAIN Lens ► geni.us/xGoDWT
Second Camera ► geni.us/CYUQ
Microphone ► geni.us/wqO6g7K

Пікірлер: 573
@TheCherno
@TheCherno 6 жыл бұрын
Hope you guys enjoyed the video! A few notes: - to be clear, each program/process on our computer has its own stack/heap - each thread will create its own stack when it gets created, whereas the heap is shared amongst all threads
@HazStepFTW
@HazStepFTW 6 жыл бұрын
So if your program is using multiple threads and there is memory which is created by one thread and needs to be read by another, for example, this memory would need to be allocated on the heap?
@josephwalker208
@josephwalker208 6 жыл бұрын
Are you going to cover multiple threads because I had I look and it seems simple but could get complicated
@Puffadderr
@Puffadderr 6 жыл бұрын
Yes. But that is really not good practice. When one thread is using something in heap allocated memory it has to lock the access to that memory until it doesn't need it anymore. So you really need to avoid using shared resources when using multiple threads. Threads are meant to do their own thing independent from other threads. You can use it to keep to keep track of like progress of all threads but continous access to resource is performance hit.
@dXXPacmanXXb
@dXXPacmanXXb 6 жыл бұрын
Objects like Enemies in a game should always be created on the heap right? Are the variables of this object then also on the heap or will they be on the stack?
@olestrohm
@olestrohm 6 жыл бұрын
the variables inside the object are created inside the object's "memory space". So if you have an Enemy with an x and a y, it will allocate 8 bytes (2 ints = 2 * 4 bytes) and store the x and y in that space.
@rawali1
@rawali1 4 жыл бұрын
How is it that none of my teachers explained any of this during my whole bachelors degree.... this is brilliant! Thank you so much!
@deadcells963
@deadcells963 3 жыл бұрын
Bad college ? 😅
@malharjajoo7393
@malharjajoo7393 3 жыл бұрын
not really, when you learn something for the first time, you might have been overwhelmed.
@quicksilver5413
@quicksilver5413 3 жыл бұрын
I honestly fucking hate it when people make 'you taught better in 15 mins than my university was able to in 4 years' comments on these videos. Like bitch please it doesn't take 4 years to learn these you just haven't been paying attention
@rawali1
@rawali1 3 жыл бұрын
@@quicksilver5413 I didn't learn more in 15 minutes than in 4 years but this particular concept was not explained... my c++ teacher was absolute garbage. My java teacher was great, and a lot of that knowledge transfers over but... meh. java...
@masihaahmadi7663
@masihaahmadi7663 2 жыл бұрын
tanks
@dub16rider
@dub16rider 6 жыл бұрын
You are insanely efficient in explaining complex material, wow..., kudos.
@felixchien1664
@felixchien1664 3 жыл бұрын
Moreover he has very nice sweat pants! Kudos for that as well
@davechan1281
@davechan1281 3 жыл бұрын
100%
@eman5300
@eman5300 3 жыл бұрын
Facts and he actually helps see the bigger picture instead of dwelling on definitions
@jaminoes_
@jaminoes_ 2 жыл бұрын
I am pretty sure he speeds up his videos as well :-)
@Earth-Worm-Tim
@Earth-Worm-Tim Жыл бұрын
I’m a Software Engineer, and my first SWE position was as a C++ developer which I learned predominantly from Cherno. I have an EE education, but I learned more from Cherno watching KZbin than I did in my Intro to C++ and Data Structures and Algorithms in C++ sequence in college. The Cherno is legit folks, but if you really wanna learn, you gotta start at the beginning of the playlist and go straight through watching EVERY VIDEO and coding along. C++ can be a frustrating language to learn, but if you learn C++ first, it’s cake learning ALL OTHER C-like languages. You’re the man Cherno!
@mauricecooper9880
@mauricecooper9880 Жыл бұрын
That’s awesome! I’m a computer science major looking for my first C++ gig. Can you tell me more about how you got it? Thank you!
@555gong9
@555gong9 4 ай бұрын
@@mauricecooper9880 Hello, I'm also looking for a job. Have you found one?
@miteshsharma3106
@miteshsharma3106 6 жыл бұрын
Happy birthday cherno!!!
@mokshithpb7991
@mokshithpb7991 3 жыл бұрын
This comment have 281 likes But 0 replies (except me)
@paulu2862
@paulu2862 3 жыл бұрын
@@mokshithpb7991 2 now
@projectvibe1226
@projectvibe1226 3 жыл бұрын
@@paulu2862 3 now
@chauffeur1560
@chauffeur1560 3 жыл бұрын
@@projectvibe1226 4 now
@Agent_Ax
@Agent_Ax 3 жыл бұрын
@@chauffeur1560 5 now
@CaffeineForCode
@CaffeineForCode 5 жыл бұрын
I like how you show why something is “expensive” or not very optimal instead of just saying it. You actually open the memory view or disassembly which is super useful! Thanks for the videos, they’re amazing!
@igorthelight
@igorthelight 3 жыл бұрын
For all C# developers: "new" does not mean, that it will be allocated on the Heap (for C# program) MyClass c = new MyClass(); // Allocated on the Heap MyStruct s = new MyStruct(); // Allocated on the Stack (in most cases) That doesn't mean that structs are ALWAYS allocated on the Stack! Just most of the times. It depends. Read about "stackalloc" keyword and about "Span" and "ReadOnlySpan". They are great!
@leixun
@leixun 4 жыл бұрын
*My takeaways:* 1. Both stack and heap memory are in RAM 0:47 2. How to allocate stack and heap memory 2:55 3. Stack memory allocation *stacks* data in the memory *in a row* and it is very fast 4:45 4. Heap memory allocation doesn't 7:49 5. Heap memory allocation needs to be freed manually by using "delete", whereas stack memory allocation is freed once the code is out of the current scope 8:47 6. How heap memory, "new" and "delete" work 10:27, allocating memory on the heap is slow
@7guitarlover
@7guitarlover Жыл бұрын
Its been 5 years since you uploaded and still it is one of the BEST video on the internet. Yours is a C++ Goldmine. could you please talk about your learning pedagogy of new things and especially C++. How did you gain so much clarity ?
@MuhsinFatih
@MuhsinFatih 6 жыл бұрын
This is by far the most complete lecture/tutorial whatever, I have seen in a very long time (possibly ever). You explained everything very clearly, demonstrated and tested them, yet did that all in 20 minutes. I am honestly surprised that this video doesn't have hundreds of thousands of views because you deserve that. Wish you the best!
@logantcooper6
@logantcooper6 6 жыл бұрын
"Stored in the caysh"
@section9999
@section9999 3 жыл бұрын
caysh money dawg
@tesla.8410
@tesla.8410 3 жыл бұрын
I understood cage first, then caysh, then i understood that he actually means cache
@theSassySquatch
@theSassySquatch Ай бұрын
Dude I read that and spit out my drink I can't stop laughing
@dameck9570
@dameck9570 4 жыл бұрын
Oh boy! I found a C++ video from you and now I'm stuck with video recommendations of your series. I appreciate that, but it's 22:30 and I wanna sleep... Seems like I wont
@Markus_included
@Markus_included 4 жыл бұрын
same
@blank-vw2sb
@blank-vw2sb 3 жыл бұрын
Damn. It's 22:35 here. Awesome COINCIDENCE
@jarektrojanowicz
@jarektrojanowicz Жыл бұрын
Thanks! One thing worth mentioning: We use heap for allocation during runtime and stack for allocation during compile time. It was mentioned somewhat in the video but I think it should be more emphasized.
@mubin2026
@mubin2026 3 жыл бұрын
The stuff that I learned in this one single video is actually insane. like, I knew about most of the stuff that he said, but since all of it was taught to me over various courses, and bits and pieces at a time, I never really could figure out how it all fit in together...This such a wonderful explanation!! All of it is starting to kind of make sense now....damn lol
@marioseis7692
@marioseis7692 3 жыл бұрын
MAGISTER DIXIT...! I am no programmer but I have had basic lessons in C almost 30 years ago and now I am strugling to master at least the basics of C#, which I find sometimes a bit confusing and with a lot of rules. Sometimes I get some comfort watching basic C ++ videos, especially those that are very well explained and that go right to the point like yours.
@TokisanGames
@TokisanGames 6 жыл бұрын
I think this is my favorite video so far. I always wondered about the stack and heap differences. This is such a good explanation!
@maxbardelang6097
@maxbardelang6097 Жыл бұрын
Very clear and easily accessible explanation, even the explaining with asssembler was just really supporting understanding.
@dongyoungkim962
@dongyoungkim962 Жыл бұрын
hey cherno, your explanation of stack vs heap is amazing, no other youtube has evern been able to explain like this. ive come across heap and stack so many times but never got to really understand untill i watched your video today. thanky you so much!
@jammerbammer1
@jammerbammer1 3 жыл бұрын
This is A+ content. For someone trying to learn to code there is a lot here and I will be re-watching this a couple of times and playing with the memory view in Visual Studio. Thanks.
@ZzBiazZ
@ZzBiazZ 6 жыл бұрын
Finally, you are back, your video always great, thank you !!
@donha475
@donha475 5 жыл бұрын
This stuff is all great man. All of your C++ videos have been amazing so far.
@ManaPie
@ManaPie 6 жыл бұрын
Hi, you could make a video explaining your way of structuring C++ projects: the way you separate your headers from source files, the way you organize your includes (precompiled header stdafx.h vs #ifndef guards), etc. What do you think? You're doing a great work, I've been learning a lot in your channel! Thanks!
@patrikjankovics2113
@patrikjankovics2113 5 жыл бұрын
#pragma once I think, instead of ifndef guards.
@xrarach
@xrarach 4 жыл бұрын
@@patrikjankovics2113 This does not always work sadly. When you start having a medium or large-sized project (1M lines ) it will start to fail for some reason sadly, happened to me many times, thus using #ifndef
@challengeyourmind3937
@challengeyourmind3937 2 жыл бұрын
@@patrikjankovics2113 #pragma once still can't prevent against including multiple headers within the same project because it excludes based on file system identity
@Decco6306
@Decco6306 3 жыл бұрын
A trendy looking programmer that makes good quality programming tutorials on KZbin that doesn't use a mac? Respect.
@kjes8639
@kjes8639 6 жыл бұрын
This was a very interesting video. Please, make more videos about the way C++ works. I am looking forward to seeing your video about CPU cache optimisation. Thank you, Cherno, love your vids.
@svenbtb
@svenbtb Жыл бұрын
This was a really helpful video, thank you SO much. I appreciate that you show WHY the dynamic memory operations are more expensive and how it can be a performance boost to use the stack. So essentially, if you want something to have a longer lifetime, or if it's of a large size, then it's worth using the Heap, but if you're making a small simple variable that won't exist for a long time, it makes more sense to just use the stack, yeah?
@Drtsaga
@Drtsaga 6 жыл бұрын
Cherno, your tutorials are always great. I love that you pay attention to what you say. You always choose your words so that YOUR AUDIENCE understands what you say, and not so that you make sense to yourself. Thank you for the good work and congratulations. I am sure when you become worldwide famous these videos will get a lot more views. I have a question for you: How did you get to point that you know the material well enough to teach it? Who/What is **your** teacher? Other than sporadically making google searches and stumbling on documentation pages, do you regularly read books on C++? Do you constantly take classes? Do you continuously engage in competitions that keep your edge sharpe? How are you so good? I am not asking how are you productive. I just wander how do you keep this volume of knowledge in your head in such an order that becomes transferable to others. If I don't refresh something for a month (give or take) I surely forget it ... xD
@nobytes2
@nobytes2 2 жыл бұрын
This is like asking a musician how she/he gets good lol. There's no freaking magic formula, is just practice and experience.
@erikb4407
@erikb4407 2 жыл бұрын
@@nobytes2 I believe he's not asking for a magic formula. He wants to know the materials / instructors / methods The Cherno uses to learn and retain the vast amount of comp sci knowledge he teaches us. Practice and experience is correct, but *how* does he practice? Is it through competitions, work, reading books, classes, etc. Hope this helps
@RemerexHD
@RemerexHD 2 жыл бұрын
@@nobytes2 he just asking for tools
@yellowlegend245
@yellowlegend245 5 жыл бұрын
Hi Cherno, nice explanation. Probably main point is not covered here. 1. Each function has its own stack area and not shared with other functions. Whereas heap is shared among all functions(within a thread as you said in a comment). 2. main use of heap is to allocate memory for pointer that is accessed across the functions. because once the functions scope is over, all stack variables are deallocated.
@readingchess
@readingchess 2 жыл бұрын
This is the first video I've watched and I wanted to say - Really well done! Such a top notch explanation. I'm subscribing for sure. Thanks again for taking the time to make these videos
@franejelavic
@franejelavic 6 жыл бұрын
Hi Cherno, Could you maybe take a video about exceptions, and why you don't like them, how to avoid them and best practices. Also a good topic to talk about is unit testing and do you write tests in parallel with your development. Thanks for everything your doing here.
@fouryeartransform3042
@fouryeartransform3042 4 жыл бұрын
I just nailed an interview question because of this and other videos. Thanks so much.
@jioferno
@jioferno 11 ай бұрын
Clear, ,fluent and to the point explanation, thanks.
@proton46
@proton46 Жыл бұрын
Great video! Heap memory is a really complex topic.... It took me a long time to figure out how it works when I was writing my own memory manager! Thanks a lot for this!😃
@annsgal2025
@annsgal2025 Жыл бұрын
One case for allocating memory on the heap is when one doesn’t know the size of data at compile time. STL containers are actually allocated on the heap internally because they grow in size dynamically when the preallocated size is not enough. So if you declare a vector on the stack, it is actually using the heap.
@omarhatem_97
@omarhatem_97 4 жыл бұрын
i have been programming c++ for almost 7 years now , what makes you unique among other youtube channels or tutorials is that you are really so deep in learning and teaching the concepts . keep going man you are awesom !
@shambhav9534
@shambhav9534 3 жыл бұрын
7 years of typing and you don't know where the shift button is?
@lucianodibernardo1546
@lucianodibernardo1546 5 жыл бұрын
Awesome video !!!
@mountgraph1403
@mountgraph1403 6 жыл бұрын
I learn so much over this channel thank you for the hard work!
@Manalor6955
@Manalor6955 3 жыл бұрын
I chuckle every time he pronounces cache.
@philippebaque5157
@philippebaque5157 6 жыл бұрын
Many thanks for your effort and your very clear explanantions.
@lijacky160
@lijacky160 2 жыл бұрын
I love you! YOU ARE SUPER HELPFUL !!!!!!!! KEEP THIS PASSION ON MAKING VIDEO. YOU ARE TALENTED
@aadikarva
@aadikarva 2 жыл бұрын
Thanks @cherno for making these videos. Few follow-up Qs: 1. How many CPU cycles does Heap allocation take for each of the examples you talked about in the video above? 2. Can you start a series on OS basics like different types of memory, how it all works at the OS level etc. Thanks! :)
@greob
@greob 6 жыл бұрын
I'm not familiar with the concept of "CPU cache misses".
@BlackJar72
@BlackJar72 6 жыл бұрын
The CPU has several levels of caches that are much faster than ram on the motherboard, but the kind of memory is more expensive and has to fit in the CPU, so there is a lot less of it. When data is used accessed it will load the whole area of memory to the cache. If the next data it needs is in the same area it will already be loaded. If not you have a cache miss, so it has to load more from ram to cache, and that's slow. Basically when you have a cache miss the CPU has to sit on idle while waiting for the data -- if it was already in the cache it could just keeps going. It could make things 50 or 100 times slower if you have constant misses versus very few (if there is much data some will happen since only so much is moved at once). This is an advantage of arrays over linked lists -- linked lists cause lots of misses, which makes them much slower than arrays even at things they're better at in theory. That's simplified a bit, since different level of cache do have different speeds too, but that should give you the general idea.
@xYuki91x
@xYuki91x 4 жыл бұрын
@@BlackJar72 Thank you so much!!! Throughout the whole video I was wondering what "cache miss" means, I was so happy to find your explanation (which is very easy to understand, so kudos!)
@mryup6100
@mryup6100 4 жыл бұрын
@@BlackJar72 May I ask where you learn about this. University? A book?
@PatrickRobinsonZA
@PatrickRobinsonZA 4 жыл бұрын
@@mryup6100 experience
@xrafter
@xrafter 4 жыл бұрын
@@PatrickRobinsonZA Experience out ranks everything
@ifeekesifeekes8166
@ifeekesifeekes8166 5 жыл бұрын
This video helped me a ton with interview questions, thank's so much!
@sayeddileri3461
@sayeddileri3461 Жыл бұрын
Thank you for this video. I have been confused about stacks and heaps. You helped me so much. Time to practice 🙌🏽🙌🏽
@KoderKapil
@KoderKapil Жыл бұрын
Best content i found....Crazy, how it is simple and detailed 🔥.. Thank you
@youssefel-mahdy922
@youssefel-mahdy922 2 жыл бұрын
I loved the way you explained them through the code, thank you truly!
@knofi7052
@knofi7052 6 жыл бұрын
Happy Birthday & Thank you very much for your great content! :)
@edgaramiri
@edgaramiri 5 жыл бұрын
You're the best man excellent explanation, thank you
@MisterPubbs
@MisterPubbs 26 күн бұрын
amazing and very clear video!
@Jonathan-ex3sl
@Jonathan-ex3sl 11 ай бұрын
Thank you so much for this content. It's been very useful for me.
@anasahtsham4033
@anasahtsham4033 3 жыл бұрын
THANK YOU SOOO MUCH MAN. VERY HELPFUL VIDEO, LOVED IT
@bandolero818
@bandolero818 2 жыл бұрын
You are awesome Cherno! Thanks for your clear explanations!
@feiyijiang9167
@feiyijiang9167 3 жыл бұрын
wow, this video is wonderful! It answers a lot of my questions. Thank you Cherno!
@davidpatry4195
@davidpatry4195 6 жыл бұрын
Thank you so much for your serie Cherno, I always learn alot watching you Happy holidays to you and your friends/family :)
@rika9317
@rika9317 4 жыл бұрын
This video is really easy to understand!! I didn't know that allocating memory in heap is such a heavy work, and didn't know why it's heavy. You showed me the way to ensure the reason, looking into the assembly code. I'm gonna consider using Visual Studio...
@deepikagoyal07
@deepikagoyal07 Жыл бұрын
Its was super useful video. Thanks and Gratitude!!
@rittenbrake1613
@rittenbrake1613 4 жыл бұрын
I just enjoy u talking, very easy to absorb
@dorkflassbury1164
@dorkflassbury1164 5 ай бұрын
Great explanation. But I think we're missing an important difference between stack and heap memory. The size of stack memory to allocate is set at compile time whereas the size of heap memory is may be set in run time. Stack memory is more easy to manage and heap memory is more flexible (and maybe more efficient since actually may allocate just as much memory as you need when actually running your program).
@xeturr
@xeturr 3 жыл бұрын
Excellent refresher for me. Subscribed.
@nickbejan4914
@nickbejan4914 6 жыл бұрын
Amazing explanation! Thank you!!
@karimpeymani6569
@karimpeymani6569 4 жыл бұрын
This is the best explanation video about Stack vs Heap I ever seen, Thanks man.
@root0062
@root0062 Жыл бұрын
I love how I get a good in depth explanation of stack & heap. Dare I say better explained than my proff. And at the end of the video I go. Wow! I have the same couch!
@krisitak
@krisitak 6 жыл бұрын
Next level videos. Thank you!
@AlaaAreesPhoenix
@AlaaAreesPhoenix Жыл бұрын
Thanks a lot man your videos are so helpful , keep going 💙💙
@pablorodrigues9811
@pablorodrigues9811 3 жыл бұрын
Thank you for this really great content, Cherno!
@vectoralphaSec
@vectoralphaSec 2 жыл бұрын
So always allocate on the stack rather than the heap whenever possible until you can't. Got it.
@dafdaf4052
@dafdaf4052 5 жыл бұрын
Very nice and informative, I am kinda addicted to your videos gj.
@neiltsakatsa
@neiltsakatsa 6 жыл бұрын
Thanks Cherno ! I was wondering if sometime you could dive into Windows Forms Applications using Visual C++ :-). I'm really enjoying your tutorials man !
@platin2148
@platin2148 6 жыл бұрын
Neil Tsakatsa Don’t think that we will ever use this api same with WinForms you probably should look at C++/Winrt wich is more native than the CLR version wich has an ugly syntax and is very slow compared to Nativ C++.
@HazemSaleh
@HazemSaleh 6 жыл бұрын
You are a king. Excellent explanation, thank you.
@WelcomeToSex101
@WelcomeToSex101 6 жыл бұрын
You should talk about move semantics. I found that it is relatively new topic and it's kind of confusing.
@Qdouble
@Qdouble 5 жыл бұрын
Amazing video! Thanks. I just subbed.
@marindraganov8765
@marindraganov8765 3 жыл бұрын
Pal, thanks a lot! It is like putting me in a new dimension with my coding! Now I have a vague idea why my projects work the way they do! Coming from Python/C# background this video is an eye opener! EDIT: Typo.
@sheepcommander_
@sheepcommander_ 3 ай бұрын
this video was helpful enough im almost willing to overlook Caysh
@lukaspetrikas6320
@lukaspetrikas6320 3 жыл бұрын
Your a very clever guy. I find your videos extremely helpful
@ChamAntonio
@ChamAntonio 3 жыл бұрын
still such an amazing and practical video now it's 2021.
@dxlge
@dxlge Жыл бұрын
amazing, explained really well and in a clean way
@alexseresalex1843
@alexseresalex1843 2 жыл бұрын
I don't really comment on videos, but this is some extra high quality stuff
@daluwang2112
@daluwang2112 2 жыл бұрын
Thanks for explaining this sooooo clearly and in an easy way!!!!! very useful!
@albertkiefel
@albertkiefel 6 жыл бұрын
Very well explained, very good examples!
@shruthiabirami7406
@shruthiabirami7406 5 жыл бұрын
Awesome video😀 understood clearly... Kudos❤
@codastudiode
@codastudiode 4 жыл бұрын
dude, you're awesome! I've learned it like a piece of cake!
@Jonny-op3wr
@Jonny-op3wr 2 жыл бұрын
Just subscribed. Enjoyed the content. 😇
@MrDarkyosh
@MrDarkyosh 6 жыл бұрын
your videos have been very helpful to me. I hope things are going good for you Cherno :-)
@marcelbarbosa281
@marcelbarbosa281 4 жыл бұрын
Sick bro
@relytheone853
@relytheone853 5 жыл бұрын
I enjoyed the video. Thank you!
@dream_emulator
@dream_emulator 3 жыл бұрын
Wow. This guy is next level and then some. 🔥
@TheShorterboy
@TheShorterboy Жыл бұрын
having written malloc's for embedded systems doing all the merges is what takes time, you can do it in a thread but that's still time you are stealing from a core and on embedded you didn't have any spare, abstracting your pointers is a way to get around this but it creates funky code no one wants to write
@LarryPeteet
@LarryPeteet 5 жыл бұрын
Very Helpful, Thanks!
@dan110024
@dan110024 5 ай бұрын
Random fun fact - 99% of Rollercoaster Tycoon was written in assembly by a single developer. Getting an understanding of even a fraction of what goes on here, it's insane to think about how good Sawyer, the dev, was.
@milosz-barylowicz
@milosz-barylowicz 6 жыл бұрын
Maybe you can cover rvalue/lvalue topic it is pretty confusing or move semantics.
@MsJavaWolf
@MsJavaWolf 5 жыл бұрын
@@Franckbery IS that all though? I always though there were like exceptions to that simple explanation.
@mateuszabramek7015
@mateuszabramek7015 4 жыл бұрын
Done
@minderiskrir989
@minderiskrir989 4 жыл бұрын
We really do need a CPU cache optimization video.. & thank you The Cherno for your informative/educational videos.
@zniverse
@zniverse 6 жыл бұрын
Your video is always great. Thank you.
@ErichDAtriGuiran1
@ErichDAtriGuiran1 3 жыл бұрын
thanks dude, good explanation
@petersenglish
@petersenglish 3 жыл бұрын
This was super interesting. However, thanks to you, I have spent hours looking at assembly code trying to figure out what it is doing.
@L1Q
@L1Q 2 жыл бұрын
finally! the no-bullshit explatation! 🙏
@duckcluck123
@duckcluck123 4 жыл бұрын
Wow, this was incredibly incredibly insightful
@basharTheSoftwareEngineer
@basharTheSoftwareEngineer 4 жыл бұрын
words cant describe this video thanks for helping
@koungmeng
@koungmeng 5 жыл бұрын
3:08 you can use: int* hvalue = new int(5); //save 1 line of code xD
@smileynetsmileynet7922
@smileynetsmileynet7922 4 жыл бұрын
Right, like using a built-in constructor.
@Djzaamir
@Djzaamir 6 жыл бұрын
Finally dude , its been some time since your last video on C++
@haznoskill
@haznoskill Жыл бұрын
A lot of useful knowledge, thanks.
@footballCartoon91
@footballCartoon91 3 жыл бұрын
@3:12 It is a worthwhile to explain that the variable name must be declared differently between variable stored in stack and in heap
@footballCartoon91
@footballCartoon91 3 жыл бұрын
@Artem Katerynych In the example he used int value; and int *hvalue; both exist on the stack while the value of int *hvalue exist on the heap.. That is from what I understand him saying.
Macros in C++
19:36
The Cherno
Рет қаралды 237 М.
POINTERS in C++
16:59
The Cherno
Рет қаралды 1 МЛН
Apple peeling hack @scottsreality
00:37
_vector_
Рет қаралды 127 МЛН
Шок. Никокадо Авокадо похудел на 110 кг
00:44
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 76 МЛН
Pointers and dynamic memory - stack vs heap
17:26
mycodeschool
Рет қаралды 1,4 МЛН
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 783 М.
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 258 М.
Dynamic Arrays in C++ (std::vector)
14:14
The Cherno
Рет қаралды 379 М.
Harder Than It Seems? 5 Minute Timer in C++
20:10
The Cherno
Рет қаралды 170 М.
Stack vs Heap Memory - Simple Explanation
5:28
Alex Hyett
Рет қаралды 229 М.
Visualizing memory layout of Rust's data types
39:39
Sreekanth
Рет қаралды 16 М.
Function Pointers in C++
12:41
The Cherno
Рет қаралды 389 М.