References in C++ Explained

2024 ж. 13 Мам.
94 450 Рет қаралды

Start your software dev career - calcur.tech/dev-fundamentals 💯 FREE Courses (100+ hours) - calcur.tech/all-in-ones
🐍 Python Course - calcur.tech/python-courses
✅ Data Structures & Algorithms - calcur.tech/dsa-youtube
~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~
✉️ Newsletter - calcur.tech/newsletter
📸 Instagram - / calebcurry
🐦 Twitter - / calebcurry
🔗 LinkedIn - / calebcurry
▶️ Subscribe - calcur.tech/subscribe
👨🏻‍🎓 Courses - www.codebreakthrough.com
~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~
↪ My Amazon Store - www.amazon.com/shop/calebcurry
🅿 Patreon - calcur.tech/patreon-calebcurry
🅖 GitHub Sponsors - github.com/sponsors/CalebCurry
Ⓟ Paypal - paypal.me/calcur
🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
📈 Buy Bitcoin - calcur.tech/crypto
Reserve the Ruby Steel crypto rewards card and get a $25 bonus (use affiliate code "Caleb") - calcur.tech/crypto

Пікірлер
  • Check out the hands on guide - kzhead.info/sun/erp-k7B5j2mlmqM/bejne.html Get notified of my upcoming C/C++ Courses - www.codebreakthrough.com/upcoming-c-cpp-courses

    @codebreakthrough@codebreakthrough Жыл бұрын
  • *sees an asterisk in code* My brain “OHHH HEEELLLLLLL NOOOOOO”

    @valkyrja7280@valkyrja72803 жыл бұрын
    • @Messiah Atticus Hehe nice scam

      @Italy-rj2eb@Italy-rj2eb3 жыл бұрын
    • You described my last week so well.

      @capitaopacoca8454@capitaopacoca84542 жыл бұрын
    • I've been like this since C I'm here to stop my confusion about pointers

      @ethangold4900@ethangold49002 жыл бұрын
    • I can hear your comment

      @AbhishekBM@AbhishekBM2 жыл бұрын
  • Did you play the clip? 😂😂 Man I love his vids. You can't be bored to death.

    @skypuff@skypuff3 жыл бұрын
  • The fact that this guy is currently carving our way for our future just for us is priceless

    @facent523@facent5233 жыл бұрын
    • Fax

      @retrace@retrace3 жыл бұрын
    • If this was your future, YOU would carve it for yourself.

      @du4lstrik3@du4lstrik38 ай бұрын
  • I've been struggling for weeks trying to understand this and pointers and you literally got it to click in 15mins. You're amazing, subscribed.

    @llllllllll5119@llllllllll51192 жыл бұрын
  • Commenting for Yt algorithm

    @tsupi7056@tsupi70563 жыл бұрын
  • Because it is very simple... which is why we need to talk about it. 😂

    @cruellnat@cruellnat3 жыл бұрын
  • Thanks Caleb, I've been following your C++ Tutorial way back 2019 because you are a great teacher, you saved me a lot.

    @rin0422@rin04223 жыл бұрын
    • I've been looking for a follow up to his C++ course. Any suggestions?

      @rohanarya5400@rohanarya54003 жыл бұрын
    • @@rohanarya5400 get working on eulerprojects Github and Codeforces. You could get a reading on the book 'code'.

      @siddharthraghuveeremadaboi2901@siddharthraghuveeremadaboi29013 жыл бұрын
  • This was incredibly helpful, thank you for the detailed explanations!

    @mykalesalad@mykalesalad2 жыл бұрын
  • Crazy. I was reviewing this earlier! Keep it up!

    @Diamond_Hanz@Diamond_Hanz3 жыл бұрын
  • this is awesome! thank you so much for creating these illuminating lectures !

    @shashanksharma21@shashanksharma213 жыл бұрын
  • This was a wonderful video. I'll be patiently waiting for more.

    @skypuff@skypuff3 жыл бұрын
  • Love your teaching method and your comedy sprinkled throughout! Thanks man!

    @THATREISGUY14@THATREISGUY142 ай бұрын
  • Thank you Caleb! I'm in a C++ bootcamp and your channel has taken me from failing to an A!

    @mordicai4296@mordicai42962 жыл бұрын
  • Thank you! This was well detailed and clear.

    @iutubgugal5566@iutubgugal55663 жыл бұрын
  • the way you teach is very effective and easy to understand. Thank you!

    @azrflourish9032@azrflourish90322 жыл бұрын
  • Great video! Exactly the explanation I was searching for

    @gremjo8409@gremjo84093 жыл бұрын
  • This was such a great video all sorts of confusion got cleared so well. Thanks brother.

    @arkapravaghosh4594@arkapravaghosh45943 жыл бұрын
  • Wow, Caleb! Thank you so much for starting this series. I am in the middle of your first series of C++. That series is really awesome. I like your teaching style. You are a great teacher. I found you concluded the previous series a little short. I am delighted to see this intermediate series is started. Kindly continue this series. Your series is really helpful.

    @nilupulperera@nilupulperera3 жыл бұрын
  • Thanks for this. POinters feels like a game of inception in my head. Especially when it comes to pointers to pointers

    @silentcal275@silentcal27521 күн бұрын
  • This is the first time any C++ concepts really started to "click". Bro, keep up the good work! Thank you for your help!

    @wendyargyle2333@wendyargyle23335 ай бұрын
  • concise and clear. thanks dude

    @dylanjackson7325@dylanjackson73253 ай бұрын
  • Great explanation Caleb! Awesome. Way to go!

    @Ajcmaster@Ajcmaster3 жыл бұрын
  • this is great. Now I got it. My prof sucks. He mixed pointer and ref and totally confused us.

    @AKTSR444@AKTSR4443 жыл бұрын
  • Nice, idk if you explained it really well or if after playing with references and coming back to an explanation was the final thing to make me understand this concept, but I feel like I finally get it.

    @nicholasmaniccia1005@nicholasmaniccia1005 Жыл бұрын
  • Wish I found this video sooner. After 4 hours of trying to understand this concept I finally get it haha. Thanks!

    @magicdragon9621@magicdragon96213 жыл бұрын
  • Nice! Thank you for this.

    @AFourEyedGeek@AFourEyedGeek2 жыл бұрын
  • you explain things the best ive seen. thanks

    @navaerick86@navaerick86 Жыл бұрын
  • this video is actually fantastic, thank you so much, i appreciate your work, keep it up and good luck with everything :D

    @marcellodelfiore1361@marcellodelfiore1361 Жыл бұрын
  • I like the technique of your teaching. Really it's a great tutorial man

    @SKMINSARR@SKMINSARR2 жыл бұрын
  • Thanks Caleb.you are an amazing teacher.

    @aberateklehaimanot9804@aberateklehaimanot98043 жыл бұрын
  • Thanks for the great explanation! I am new to C++ and needed to understand this, and also the part after 13:00 was very informative and useful!

    @MrMcgrizz@MrMcgrizzКүн бұрын
  • You are a great instructor.

    @monkeyrobotsinc.9875@monkeyrobotsinc.9875 Жыл бұрын
  • just perfect ! thank you!!

    @ddkan_9982@ddkan_99822 жыл бұрын
  • Thank you for this very useful video!

    @higiniofuentes2551@higiniofuentes25518 ай бұрын
  • Bravo! Thank you.

    @ddimwhite4638@ddimwhite46383 жыл бұрын
  • Thanks man. You helped me a lot.

    @DonaldMurf@DonaldMurf3 жыл бұрын
  • Bro. You're a beast. This is just what I was looking for.

    @jacobpickos733@jacobpickos733 Жыл бұрын
  • Thank you very much. God bless!!!

    @krup9898@krup98982 ай бұрын
  • Love this video, he really does explain it far better than the course material in the 300 level undergrad course I'm currently taking. Also... LEEEEEEEEROYY JENNNNNNNNKINS

    @ChadTower@ChadTower2 жыл бұрын
  • Great video, thank you man

    @tomitomi7941@tomitomi79419 ай бұрын
  • Good tutorial. Thanks.

    @audiodiwhy2195@audiodiwhy2195Ай бұрын
  • i am in love with your teaching style.

    @harismasoom6634@harismasoom66342 жыл бұрын
  • 10:35 troll joke made me chuckle out loud, great video!

    @Basedmarv@Basedmarv2 жыл бұрын
  • so far the best explonation i could find

    @jakubdzwigacz4563@jakubdzwigacz45632 жыл бұрын
  • Thank you well explained

    @wildLeaner@wildLeaner8 ай бұрын
  • This can't be explained better than this. Top notch

    @heshansandeepa6387@heshansandeepa63872 жыл бұрын
  • Very well explained!

    @Meridian-lk2fo@Meridian-lk2fo Жыл бұрын
  • Thank you so much ✨

    @thatgirl7650@thatgirl76502 жыл бұрын
  • your r great... such a simple and clear explantion /////

    @ECEPAZHANIMURUGANSIVAP@ECEPAZHANIMURUGANSIVAP Жыл бұрын
  • Just finished the last series and I really hope this is the start of part 2

    @jason27kboy@jason27kboy3 жыл бұрын
  • Thanks for the tips

    @OpheliaSHolmes@OpheliaSHolmes3 жыл бұрын
  • Nice video. I like how you dont write any code on a computer. makes it better

    @Captain_Rhodes@Captain_Rhodes3 жыл бұрын
  • This is awesome !

    @sadatshahriar2090@sadatshahriar20903 жыл бұрын
  • Helped some what keep it up

    @jalalhamza1344@jalalhamza1344 Жыл бұрын
  • exactly what i looking for!

    @hamdansiddiqui3294@hamdansiddiqui329412 күн бұрын
  • I love the way that you write & diffrent in every time😂😂

    @erfanelmtalab3426@erfanelmtalab34263 жыл бұрын
  • Thanks a lot!

    @nicolascrespo4643@nicolascrespo46432 жыл бұрын
  • Great video!!!

    @petarvico1757@petarvico17572 жыл бұрын
  • Best caleb in the world 👍❤️

    @akarcel@akarcel3 жыл бұрын
  • "But no... you just got trolled" I almost spit my coffee

    @lucasmuller7179@lucasmuller71792 жыл бұрын
  • Thanks caleb 💛

    @7s9n@7s9n3 жыл бұрын
  • thank you for this

    @codingwithflavio8534@codingwithflavio8534 Жыл бұрын
  • Well explained

    @uttamkarmakarece3534@uttamkarmakarece35342 жыл бұрын
  • Few basic examples to remember: void work (x){return x;} // No reference void work (&x){return x;} // Argument reference void& work (x){return x;} // Function reference void& work (&x){return x;} // Argument + Function reference int& a=b; reference variable to variables int&& ref=work(x); reference from function (without reference) to variable int& ref=work(x); reference from function (with reference) to variable

    @pacocarrion7869@pacocarrion7869Ай бұрын
  • You make learning this like 10 times more fun, i apprecieate it!

    @mellow_frequencies@mellow_frequencies2 жыл бұрын
  • Dude you are on fire today.

    @NikhilSharma-jj6bx@NikhilSharma-jj6bx3 жыл бұрын
  • At 13:30, what if you did like &b = &c? Would that work or can you only assign b directly and not it's address?

    @TomtheMagician21@TomtheMagician21 Жыл бұрын
  • Your the best bro

    @mrmoody915@mrmoody9154 күн бұрын
  • After watching this video I have two things to say: 1 - thank you, your explanation is heaven sent and 2 - after your Leeroy Jenkins comment, I gotta ask. You play WoW, because if you do were gaming 😂

    @AshShawwa@AshShawwa10 ай бұрын
  • how can we use pointer to reference like this (int *& a)

    @jeyosman1@jeyosman1 Жыл бұрын
  • "Maybe that's a bit more depth than you need for this introductory video" Nope. Not for me, at least. That last detail you went over was super helpful. Thank you for the great video!

    @isaacchen3857@isaacchen38573 жыл бұрын
  • Thanks Caleb

    @rabbi8453@rabbi84533 жыл бұрын
  • I love this 😇😃omg so useful

    @MikeLGMFX@MikeLGMFX3 жыл бұрын
  • there is no love it button, so i will type. Love it, thanks a lot.

    @marcusantenor793@marcusantenor7935 ай бұрын
  • Subscribed! 🙂

    @KaustavMajumder@KaustavMajumder3 ай бұрын
  • perfect!

    @MrKurdishFreak@MrKurdishFreak2 жыл бұрын
  • I got problems but I had problems with understanding reference. It seems to me like reference is sometimes treated as a memory address but then you can also treat them as normal variables. When it comes to pointers it is clear when that you always have a memory adress and if you want to see what is on that memory address, or change what is on that memory address, you deference the pointer by putting a * in front of the pointer. These references are a little bit confusing because they sometimes act as pointers and they sometimes act as normal variables. I don't see why I can't just replace references with pointers. For instance the function swap would go like this. void swap(int* a, int* b) { int temp = *a; *a = *b; *b = temp; } Also, when you use pointers as arguments of a function you know you are passing memory addresses to the function so you expect that the function might change the variables whose addresses you are passing. I find pointers more clear and understandable than references.

    @smrtfasizmu6161@smrtfasizmu61612 жыл бұрын
  • QUESTION: 7:58 to 8:04....doesn't "int &x" at the function refer to the 'address' of 'a' rather than the 'value ' of a ( ie '5')? That is, when we call the function, aren't we passing in the "address of a" rather than the "value of a"?

    @okkami676@okkami6763 жыл бұрын
    • How I think of it working is: when you call work(a), internally the program is saying int & x = a; and then doing the things on x. I need to retrain my brain on how the function arguments work from my Java days, but the 'int' is always correct, and says that the function expects an integer. If it is 'int & x', it will get a reference to an integer, and if it is 'int * x' it will get a pointer to an integer.

      @masheroz@masheroz2 жыл бұрын
  • Hey can you make something on typescript

    @keshavjha2641@keshavjha26413 жыл бұрын
  • I hate this dude when i was noob but still want to see this dude

    @SebleBeyene-jp8hp@SebleBeyene-jp8hpАй бұрын
  • 4:28 I actually thought all this time that this were 3 completely different things. And it's just a variation in writing.

    @christianalvarado528@christianalvarado5286 ай бұрын
  • Thx

    @user-dy1vf7lu3i@user-dy1vf7lu3i Жыл бұрын
  • This is a great video and I understand references and pointers now (from your other video). However, I could change the variables that were passed in as parameters even without references. For example (in C++ still because I've been learning for 2 days so far lol): void Swap(int x, int y) { int temp = x x = y y = temp } And that works fine so 🤷

    @TomtheMagician21@TomtheMagician21 Жыл бұрын
    • its not the same as he said in this case x and y would be a copy of the values you passed, the variables outside the fuction will still be the same even if you change the values in x and y

      @flyingspaghettimonster8612@flyingspaghettimonster8612 Жыл бұрын
    • @@flyingspaghettimonster8612 Oh ok thank you, would I need to create a reference inside the function then and then change the value of that reference? That's pretty cool

      @TomtheMagician21@TomtheMagician21 Жыл бұрын
  • IS THE USE OF "&" SAME AS WHEN YOU USE IT I EXCEL?

    @msingizanengwenya6707@msingizanengwenya67073 жыл бұрын
  • Dude you own.

    @isaiahdawkins1870@isaiahdawkins18702 жыл бұрын
  • Thankssss

    @ichan2607@ichan26073 жыл бұрын
  • you legend

    @hlokomani@hlokomani3 жыл бұрын
  • this is mean, reference is not a new variable refer to specific place in memory? it is the variable which it refer to??!! so this is not add on size of memory one place! right?

    @karimmuhammad7051@karimmuhammad70512 жыл бұрын
  • This is FUN-THEN-MENTAL (fudamental)

    @skypuff@skypuff3 жыл бұрын
  • Young and Intelligent Your the best teacher Caleb. From Ethiopia

    @Ab-zq2ye@Ab-zq2ye3 жыл бұрын
  • I understand it now :-)

    @lator1941@lator19412 жыл бұрын
  • 12:05, I still don't get it, what if i just write "void swap (x,y)" in the first line ? btw, ur vid is just so clear, i can understand most of it quite ezly, i just dont get the idea of benefit when using it and the question above, why should i assign reference to a var when i can just call it directly ? Thank you :))

    @-kindredeternalhunter9907@-kindredeternalhunter99072 жыл бұрын
    • Hi, I may not be the best person to answer but I'm gonna try... So, if x and y are global variables then you can easily do that, but if the function is separated from the variables and they are not global then you need to pass them through parameters, that's where the references come handy because you can actually change the variable itself and not just make a copy when you call the function. Hope this helps

      @jennims2885@jennims28852 жыл бұрын
    • @@jennims2885 so ur idea is if i pass (int &x) what happen inside the func will change x actually, and if i pass (int x) , func will only use x for calculate and after the func is called, x return to its before func calling value ?

      @-kindredeternalhunter9907@-kindredeternalhunter99072 жыл бұрын
    • @@-kindredeternalhunter9907 yes, the function just makes a copy of the variable to use it inside the function, it will not change the variable itself; once the function ends, the copy gets erased. So for example, if you want to make a void function that can't return anything you will not be able to change the variable itself, the only way to do so is by using references.

      @jennims2885@jennims28852 жыл бұрын
    • @@jennims2885 finally i got it, thank you !!

      @-kindredeternalhunter9907@-kindredeternalhunter99072 жыл бұрын
    • @@-kindredeternalhunter9907 Glad I could help ^-^

      @jennims2885@jennims28852 жыл бұрын
  • Wait, is this C++ series part 2

    @xcalimburdeveloper3929@xcalimburdeveloper39293 жыл бұрын
    • kinda

      @lexuthelexer1212@lexuthelexer12123 жыл бұрын
    • @@lexuthelexer1212 ok thanks

      @xcalimburdeveloper3929@xcalimburdeveloper39293 жыл бұрын
  • Frankly it is very difficult to give my comments to anybody but you deserved highly top and your flag is great I am still can't find thanking words for long time being misunderstood.

    @mohamedeljabri4970@mohamedeljabri4970 Жыл бұрын
  • So basically a reference is like a desktop shortcut for an exe application.

    @Miyano_Shiho4869@Miyano_Shiho48692 жыл бұрын
  • what a mad lad

    @TheMCMaster@TheMCMaster2 жыл бұрын
  • Is there a playlist for these videos so I can watch them in order?

    @sabahoudini@sabahoudini3 жыл бұрын
    • you can just enter to the channel and then go to playlists, so you can find it as a playlist of arranged videos

      @hasandarwish6361@hasandarwish63613 жыл бұрын
  • DADDY CALEB HELPING ME BECOME A BETTER PROGRAMMER thx DADDY

    @RFTAKZ@RFTAKZ7 ай бұрын
  • Epic

    @bimosc.3243@bimosc.32433 жыл бұрын
KZhead