I'm laying with my phone at 3:14 am on christmas eve and watching c++ tutorials. What has my life become.
@lucasgroves137 Жыл бұрын
Yes. That is sad.
@LuskyMJ Жыл бұрын
@@lucasgroves137 I actually felt pretty happy at that moment.
@lucasgroves137 Жыл бұрын
@@LuskyMJ So you were crying wolf. And on Xmas Eve too. 😄
@SOME_BORED_GUY Жыл бұрын
After a year now I'm sure that you realized you did the right thing 👍
@lilfelix8955 Жыл бұрын
At least you have a good taste in Anime girls
@KamilKhanYT4 жыл бұрын
He talks about references like the priest talks about angels.
@ppbb66994 жыл бұрын
that's right
@HaragothNAR4 жыл бұрын
It really is fascinating, I lost my shit when I learned about pointers/references.
@RanMC9918Ай бұрын
"glazing" in 2024 slang
@ToxicityGameDev7 жыл бұрын
I think I'm going to comment on every one of these videos.... Again, hands down, best C++ videos on the web... hands down.
@benjaminf.37606 жыл бұрын
agree
@GfastGao6 жыл бұрын
Any reason with that? Said little boy?
@masasikisimoto266 жыл бұрын
Have you guys seen Bucky's C++ tutorials? They are much better.
@michaelm.36415 жыл бұрын
@@masasikisimoto26 Bucky covers a lot and does it quick, but he doesn't go to the same depth that Cherno does when describing concepts. Speed isn't always better, and Cherno ensures to cover a lot of important concepts that Bucky doesn't necessarily get to in an appropriate manner. That being said I enjoy both of their videos.
@sarveshkaran93805 жыл бұрын
Truly appreciate these stuffs. Its a bench mark for a standard video
@joebruh82302 жыл бұрын
That incrementing integer through memory addresses part is what really blew my bloody mind. Lower level languages never cease to surprise me. Coming from python, I feel like I'm capable of black magic now.
@NphiniT Жыл бұрын
Black magic 😅
@theseangle10 ай бұрын
Wait till you learn C
@NovacStudios2 ай бұрын
Trust me my mind is more blown im coming from roblox studios Luau 💀
@beebstergames7348 Жыл бұрын
I have been a 'C' programmer for over 40 years. I was a systems programmer for Unix. I came here to get an explanation of Variable References and I just want to say thank you. I watched a few other videos but this was the best explanation. Thank you for being simple, concise, and clean in your explanation.
@Hoptronics Жыл бұрын
@@forbidden-cyrillic-handle same.
@Aaronmac4045 жыл бұрын
Once C++ starts clicking for you, it REALLY makes sense. Damn. No wonder this shit has been industry standard for so damn long.
@contruq3 жыл бұрын
i kinda got problems with learning C++, so i rewatch these vids
@DragonKidPlaysMC3 жыл бұрын
@John McGee rust will take over c++
@hmthatsniceiguess28283 жыл бұрын
@@DragonKidPlaysMC Rust isn't taking over anything, definitely not C++. You don't realize what you're saying. Apart from some more narrow use cases, C++ will reign supreme for a long time.
@VivekYadav-ds8oz3 жыл бұрын
@@hmthatsniceiguess2828 Almost the entirety of Firefox is written in Rust. Chromium has started including Rust in it. Hell, even the Linux kernel, which shunned C++ from its codebase, is going to start using Rust in it. C++ is fun to write and experiment in, Rust is not. It's a bit locked down. Rust is fun to write a serious application, when memory leaks become a serious issue and GC isn't an option and smart pointers are too much of a runtime overhead for you liking.
@kallht20793 жыл бұрын
I really hope I'll reach that point
@etiennewijler68304 жыл бұрын
Mate, your videos are the best. Just to give you some insight into the variety of your target group and the impact that your videos are having: I'm an assistent professor in Econometrics at a top international university. As part of my research, I have developed novel statistical estimation procedures that work great for high-dimensional datasets (big data). The estimators can be computationally heavy and I have always programmed them in R, which made the computations painstakingly slow. A year ago, with the help of your videos, I made the switch to C++ (through the use of Rcpp) and my code has sped up x100. Not only have I been able to obtain valuable scientific insights by means of simulations a lot faster now (and publish them faster in academic journals), I have also turned my code into R packages, backprogrammed in C++, and made it available for other researchers. This explanation on passing by reference alone has saved me and researchers using my package a ton of time! Thanks a lot and please keep doing what your doing.
@serhiih.4724 Жыл бұрын
100%
@AlexTheGreatish6 жыл бұрын
5:34
@daginganinja40754 жыл бұрын
The most articulate videos regarding computer programming that I have ever watched! I know this is a very "old" video at this point and, perhaps, there are better ones to comment on but there are clearly still people benefiting spectacularly from this series. I guess you're still the best of the best!!
@omearsaeed6 жыл бұрын
Truth be told! your explanations are much much better than the paid lynda courses on C++! Thank you for these amazing videos!
@biqbicle4982 Жыл бұрын
yeah maybe cause your teacher probably never had a job at ea💀 its the hard truth
@roboking10203 жыл бұрын
I'm not exactly sure if this series is beginner friendly. There are places where if I was a beginner, I feel like I'd be totally confused (then again that might not be the case for everyone). But as an intermediate programmer coming from C#, this stuff is pure gold. Super helpful and very well explained.
@AlaaAreesPhoenix Жыл бұрын
no this series is clearly not to follow from scratch , but when u get familier with basic stuff this is 100% the best place to come.
@heavymetalmixer91 Жыл бұрын
As you say, it's not mean for beginners in programming. But, if you already know the basic concepts of programming like variables, conditionals, loops, functions and clases, then this course is really good.
@cagdascevrim693 жыл бұрын
dude these videos are like three years old now so idk if you're gonna read this but you are so helpful thank you so much
@alphatier49196 жыл бұрын
By the way... This: #define LOG(x) std::cout
@konsulan75765 жыл бұрын
@@rrmm5453 Because 16 in binary is 0001 0000. He is bit-shifting it to the left by 2 (16
@RandomDays9065 жыл бұрын
@Neel Shukla when the preprocessor sees '
@idk-bv3iw5 жыл бұрын
@@RandomDays906 The preprocessor doesn't see anything, it just copy-pastes code and just replaces x with the argument. So std::cout
@piechulla19664 жыл бұрын
@@idk-bv3iw This is why Stroustrup (and everybody else) warns against the preprocessor. Or at least against overuse. But most of the time we are working with 'legacy code', so we have to be aware of the pitfalls and endure the headaches.
@jeremygong41902 жыл бұрын
that 3 types of input is amazing! basically included everything you need to know to take advantage of pointer reference and a single variable. Amazing vid!
@alsayedalsisi27097 жыл бұрын
Man, you're really awesome. I have seen many many tutorials in many topics before, but I have never seen such high quality nor someone who has such knowledge or clear way to explain things like you. I am really a big fan of yours.
@Fronzel.Neekburm3 жыл бұрын
From an old 'C' programmer trying to break old habits and fully convert to 'C++' way of things, these videos are awesome. Short, simple and to the point and even work at 1.5 playback speed. I now have the urge to find out when references was added to the language and if it has anything to do with ".Net"'s arrival?
@juniorcomsono2 жыл бұрын
are you watching his videos on 1.5 playback? i'm even struggling on the normal speed lol
@davidbatetc7 жыл бұрын
These videos are so useful! Thank you for your time :)
@michaelm.36415 жыл бұрын
Thank you Cherno for your high quality videos. I don't normally do projects in C++ but I needed to create a plugin for a program that is written in C++ and your videos made this a breeze.
@gabrielmaria27626 жыл бұрын
Watching some of your videos as a total beginner in C++ and coding in general I'm like "Oh, now I get it" in the first half to "What the..." towards the end of the video. Great work by the way! Thanks a lot!
@CheatCodeSam6 жыл бұрын
Currently reading through "the C++ programing language 4th edition" and these video help understanding it immensely. Thank you!
@MsJavaWolf5 жыл бұрын
Great book. Once you read a certain level I would recommend it to every C++ programmer, even if it can be a bit scary at first.
@mastershooter644 жыл бұрын
@@MsJavaWolf so... once you learn the basics of c++ you should read "the C++ programming language 4th edition"?
@MsJavaWolf4 жыл бұрын
@@mastershooter64 I've read it a few years after I started learning c++, so I already knew a bit more than just the absolute basics but I think you can also read it earlier. I would not recommend reading it in the first few weeks or so though, because it is very technical and might be confusing. But I think at some point it's very helpful, it's very thick and thorough, it filled many small gaps that I had als self taught c++ programmer.
@platch235 жыл бұрын
Every video in this series is absolute gold. Such clarity. I'm curious how much of this changes with C++14
@daniazzam11612 жыл бұрын
I am new to this series, is there a lot of changes in the newer Cpp versions?
@wowvain29892 жыл бұрын
@@daniazzam1161 newer CPP versions almost never affect core concepts such as variables, normal pointers or references so you dont have anything to worry about. Only the advanced concepts of the langauge can change with a new CPP version/standard
@thestarinthesky_4 жыл бұрын
I have been too lucky to find this course today in KZbin. It is 12:35 am and I can’t stop watching these amazing tutorial. You should be teaching at Harvard. Please upload videos on optimized C++
@Tracks7777 жыл бұрын
Great content
@TJBEATSAMV12 күн бұрын
Love how you used the references tutorial to further explain pointers xD
@w3w3w35 жыл бұрын
Best c++ videos on the web! Thankyou.
@teo-medesi4 жыл бұрын
The fact that this is one of the best courses for learning C++, In-depth theory, and clean code and it's free just boggles my mind.
@aMulliganStew4 жыл бұрын
Syntactic sugar, indeed. Here's a fun little experiment to try at home: int *pi = new(int); int& ri { *pi }; ri = 6; cout
@ganeshshenoy26156 жыл бұрын
Thank you for that quick summary for the documenting the use of pointers and references as alias/ address alloc. I will come back to this video every time I run into a snag. Thanks again.
@QuintinMassey3 жыл бұрын
Oh man… this was exactly what I needed to see. Thanks for showing the simple example with the reference to a first, then confusing the crap outta me with function example where you use de-referencing and pointers, then getting me back on track with the pass by reference example. I needed to see the easy then convoluted case before I could understand why the final example was the way to go. You clearly thought that through. You’re awesome.
@SanteriP2 жыл бұрын
Seeing this video after the pointer video actually also made pointers way clearer to me as well once you started comparing their functionality at the end of the video. Amazing stuff.
@Konslufius3 жыл бұрын
I used & in Parameter for quite sometime now and I never realised that it's actually the memory address I'm referencing. I finally start to understand the importance and usefulness of pointer and memory addresses.
@ch3dsmaxuser Жыл бұрын
On of the clearest explanations I've ever seen, kudos to you, for being so clear.
@interstellarj52185 жыл бұрын
I love your no-nonsense explanations in clear english! Please take my horse as payment.
@yumje33772 жыл бұрын
You explain every concept in a so concise and understandable way. Helped me a lot. Thx.
@satellite9645 жыл бұрын
This little 10 min video could've saved me so much pain back in 2016 when I was doing CS at uni. -__-
@Nam_David Жыл бұрын
The instruction is really clear and on point, I won't be confused the notion of Pointer and Refference anymore. Really thank you
@serhiy20203 жыл бұрын
Best and most simple explanation on pointers and references. I think it's better to use pointers instead of referees because it communicates clearly that we're passing a pointer to a function and as a result the variable can be variable can be changed.
@vasuki91097 жыл бұрын
Dude, you dont know how much I owe you. I think that I already saw at least 2/3 of all of your videos. I'm graduating in computer science and..I was really dismotivated... I have nice grades and all, I understand the theoretical part of the classes but I was getting dismotivated at each semester and no interest at all in coding. Your videos gave fresh air to me and to my graduation. You're trully amazing. thanks.
@yadav-r2 жыл бұрын
I was frustrated with this & but now it seems all clear, everything makes sense now. ThankYou
@chomiyeons Жыл бұрын
i used to struggle with pointers and references but this video rlly helped me a lot. thank u cherno
@casperes09123 жыл бұрын
I prefer the pointer version, because you will know both at the declaration of the function and at the call-site that the value can be changed by the call. If you never declare a function with references a(b); will not modify b because it’s passed by value.However, if references are used, you have no idea at the call-site if you’re actually passing b as ref or as value
@FINTHRTD4 жыл бұрын
In short, we use references to save space in RAM as much as possible or wherever possible and use pointers when we intend to change the memory address we are pointing to, or to allocate a chunk of memory to a variable.
@calibr06364 жыл бұрын
this video actually made what pointers are more clear to me, thanks man
@manuel_youtube_ttt5 жыл бұрын
Better explanation than the one found in the "The C++ programming language" by the creator of C++. There I didn't understand a bit. Here I swiftly got it! Thanks!
@nexusclarum80004 жыл бұрын
In books like that they don't try to be easy to understand. They try to be precise. Well, being easy to understand isn't the primary objective at least.
@klarnorbert4 жыл бұрын
I also got a book from him, but it's like he's talking alien.
@nexusclarum80004 жыл бұрын
@@klarnorbert The issue with certain books is they assume prior knowledge in certain areas. It's like if you picked up a calculus book it's going to assume some prior math knowledge. Computer science and programming books can be very much the same. If you're an absolute beginner or nearly that then its something worth looking into before buying a book.
@joelcurtis5624 жыл бұрын
@level90s Second this. Great book. Make sure to get 2nd Edition.
@polymakegames4 жыл бұрын
Lmao. A few years too late Cherno, but I straight failed my CIS class that just taught basic C++ because of this particular chapter kicking my ass. Your explanation just cemented what I felt I found out while working in Unreal engine with their Blueprints. But I was never able to grasp it in a pure C++ environment. Now I do. Thank you man.
@crazychase4437 ай бұрын
years of trying to understand references, and now after one of your 10 minute videos i've finally got it. THANK YOU!
@begum52074 жыл бұрын
I just want to say thank you. Your teaching is so good.
@samuelkovanko71983 жыл бұрын
I though pointers and references were way more complicated but this makes perfect sense!
@DwightJames-t8v Жыл бұрын
This series of videos is very beginner-friendly, the first half of the series is very detailed, but the latter is a brushstroke, all in all, very well done!!!
@t.i.theking79605 жыл бұрын
I cannot believe that there are people who would actually dislike that man's video for fck sake I do not believe that someone can actually come up with a better explanation than this. Congs man love you.
@TheChemicalBassist5 жыл бұрын
Even though this is about references... Ironically this is an excellent video displaying the usefulness of pointers. Your examples and explanations are top tier.
@juanpablogomezgarcia18354 жыл бұрын
Best c++ series ever, i understand pointers in 30min after 5 years in college :(
@trungthanhbp4 жыл бұрын
u suck
@DarkblueRadiance6 жыл бұрын
Thank you so much for making these videos. I'm a self-taught programmer when it comes to C++ and C (in uni we only learn Java) and until just now I never really grasped the concept of pointers and references. Awesome work and great explanations!
@Sarah-pf4ec7 жыл бұрын
This video series has been extremely helpful, thank you for making them.
@imanhn4 жыл бұрын
I really enjoy your videos cause not only I don’t need to fast forward it, but sometimes I have to even pause to check out the codes!
@flamag73462 жыл бұрын
The best tutorials I found so far. Explanations are clean and understandable. Much better than my school.
@ManpreetSingh-cs5kp4 жыл бұрын
Cherno is doing a great job, a true dev , learned from his known experience and sharing it in terms which a normal person can easily understand.
@satyamanu221121 күн бұрын
So basically, int a = 5; stores a value &a = address of that values int* ptr = 0x00..... stores an address *ptr.... = value at that address int& ref = a; basically means we are giving the nickname "ref" to a variable named "a"
@muhammedimdaad3 жыл бұрын
believe me. I am coming from Stroustrup C++ book. I didn't understand references there. and Booooom. it's crystal clear now.
@jzxdrift5 жыл бұрын
Can you please make a video explaining rvalue references, universal references, std::move and std::forward? Why we need them, when and where we should use them, etc. Thanks.
@ykyjohn Жыл бұрын
variable are really just an reference to a memory if you will. A pointer is a special variable which holds memory address but essentially is a reference to a particular memory which will hold an address of another address of memory. The same comparison you did between types of memory. It all does about the same essential thing.
@candle-likeghost95233 жыл бұрын
pointer makes me feels more logical and makes more sense. reference makes the whole code cleaner but you might forget the 'variable' is really a 'variable' or a reference
@brillianttree39063 жыл бұрын
References do occupy memory since under the hood they are just pointers(can be seen using disassembler). But I guess it depends on compiler implementation. Just as you said they are supposed to be used as an alias. And they make the call by reference look a lot cleaner than the pointer version.
@Reydriel2 жыл бұрын
I assume that, unless the reference is used to pass something to a function call (cuz the function needs to store that pointer somewhere), the compiler will just optimise it away as a simple alias in release mode. Maybe not in debug mode though
@brillianttree39062 жыл бұрын
@@Reydriel Sounds reasonable.
@THEBLOODYCKANDY5 жыл бұрын
You really know how to explain things with precision. Not everyone has the ability to do that. This series is amazing and I hope you keep updating it cuz it`s really needed.
@vincentm996 жыл бұрын
4:04 the best explanation ever of function, thank you soooo much
@jerryleemelton18605 жыл бұрын
I just recently discovered your channel and I must say I agree wholeheartedly with a lot of the other viewers who say that this is the best C++ resource on KZbin! Thanks so much for the fantastic content! Your channel has been invaluable in my quest to learn C++!
@gijimbo13372 жыл бұрын
This is still the most intuitive video I've ever seen on C++ references.
@vimleshkumarkanaujiya3 жыл бұрын
Your all videos are saving my life in August 2021. Thank you.
@루먀먀먕3 жыл бұрын
Every time I want to get the variable's value and change that, I couldn't. But this way it could be sense! Thanks for making this awesome video!
@jeanahollings2 жыл бұрын
there's a nonsense quote on the internet quoting einstein (the nonsense part is that he probably didn't say it) that says, "If you can't explain it simply, you don't understand it well enough." you are the epitome of this. you explain things in regular terms, things that too many teachers explain like it's freaking magic. thank you, is what i'm saying, thank you for explaining this so simply and clearly. thank you.
@PabitraPadhy3 жыл бұрын
M = Memory (References are alias of same memory, whereas pointers are another variable that has it's own memory) A = Assignment (References need to be assigned on creation, pointers do not need this) R = Re-assignment (References cannot be reassigned to another variable, if done, it'll copy the value of the other assigned variable, assuming type is right, whereas pointers could be assigned in all types and shapes) A = Arithmetics (References if performed arithmetics in arithmetic change in it's value, whereas arimethics performed on pointer, without deferencing, will change the address itself.) Few points, I remember this as Kate MARA 😂, I mean who wouldn't remember kate mara !!
@2khz4 жыл бұрын
Seeing a man in his kitchen talking about C++ is bizarre, but a nice breath of fresh air from a man talking behind screen capture software
@cheemsinu21474 жыл бұрын
Thanks for this awesome C++ tutorial series :)
@pavanmadhyasta774311 ай бұрын
Perfect tutorial series, truly awesome
@Matt234885 жыл бұрын
References always slightly confused me before. Like, I've understood how to use them but I have always been confused about the actual difference between pointers and references. Your explanation that references are syntactic sugar for pointers makes perfect sense and completely eliminated the confusion. Thanks! Great series!
@ccgb926 жыл бұрын
5:58 OMG order of the operations! So that's why the (*value) is used instead of *value omg thx. always wondered that :O
@xinli95552 жыл бұрын
Great series! Comment to share one confussion I got about the code syntax for definition of the inference parameter in the function signature. Conventionally, the signature can be, for example, void Increment(int& value); or void Increment(int &value);. They are basically the same because whitespaces doesn't matter.
@mayankdixit4014 жыл бұрын
compiler convert "int &ref=a" as "int *const ref = &a", and C++ automatically converts "ref to *ref", so that clarifies many things,
@Mobin924 жыл бұрын
Using a reference as a function parameter also ensures that you are passing in a valid variable, instead a pointer that could potentially point to nothing or garbage.
@atilacorreia Жыл бұрын
I would explain that passing by pointer and passing by reference have a slight difference. By reference you're passing the address itself, where by pointer you pass the copy of the address
@sleepyNovember_project8 ай бұрын
so may be if you had a some pointer that occupies memory address, you can accept it by reference in function parameters like this (int *&)
@mostafamagdy77315 жыл бұрын
I've been learning C++ for a couple months. Not my first programming language. I must say it is not easy, but so damn simple that you don't believe it. Hence why it feels complicated. It's like you just can't take it that it can be truly that simple so you feel you're missing something or you don't understand something.
@teacup30006 жыл бұрын
I was struggeling with a similar problem, and this just makes so much sense now! Thank you.
@jonforhan91962 жыл бұрын
I LOVE this video totally changed the way i look at C++ and what i can do you are amazing
@stephenwu43796 жыл бұрын
This is the BEST C++ videos ever! The concepts and examples are very clear and it is very useful!
@whatisuser5 ай бұрын
I wish he would have explained return by reference too. That shows something that a normal pointer can't do directly. Like, you can make greater(a, b) = 50; or something and the 50 will be assigned to the greater number. Either a will be 50 or b will be 50 depending on which is greater. You can't normally do this with pointer, you would have to copy the function to something.
@EloTimeYT6 жыл бұрын
One important point is missing though. You can redirect a pointer &ptr = ..., you cannot do this with a reference. Hence the reference is always pointing to the thing it pointed to when created.
@kinsondigital5 жыл бұрын
This is by far the best explanation I have seen about references and its relations to pointers. Very awesome!!
@akshaymanthekar1032 Жыл бұрын
Thanks Man... Very well explained the concept of references!
@md.rezwanferdous28746 жыл бұрын
You just got a permanent fan, i just can't say student for now coz i'm not learning c++ right now, but really inspired by your videos, keep up the good work man. Thank you so much for giving us awesome videos like this.
@dorothyglade90875 жыл бұрын
Thank you so much for doing this! This was incredibly helpful. I'm about halfway through my C++ class at school and I could not have gotten this far without you! Thank you for this service to the Dev Community!
@DragoEliteN4 ай бұрын
IMHO in a complex structures it is easier to miss that you deal not with the local variable which was set while calling the function. And you could potentially spend some time debugging that. But it could be really helpful if you find yourself typecasting many times.
@gavinxu16223 жыл бұрын
Really simple explanation and easy to understand!
@kayumbamaxime86583 жыл бұрын
thank bro, your explanation is so clear. i appreciate what your playlist
@whalingwithishmael77514 жыл бұрын
Thank you. Your videos are deeply appreciated.
@jdvd6 жыл бұрын
Hey, great work. I am refreshing my C++ and your videos are great. However, I'd like to point this out: int a = 5, *p_a = &a, &r_a = a; r_a += 5; std::cout
@Thadnill4 жыл бұрын
I am serious when I am saying that you are probably the only youtuber that doesn't make me lose concentration or fall asleep after 10 minutes! Thank you
@meh16727 жыл бұрын
You just explained my biggest confusion! :D
@jacobgordon97705 жыл бұрын
Your video is clear, concise and filled with helpful examples. Great series Cherno!
@jessefinnegan17194 жыл бұрын
I think the biggest thing I struggle with when it comes to C++ is knowing the context for '*' and '&' in other peoples code. When I see a long statement that combines multiple uses of one, or both, then you begin adding in '()' my brain crys.
@SyIvIus6 ай бұрын
The last example may be used in games like Final Fantasy, when you switch the character in action.