C++ Pointers - Finally Understand Pointers

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ก.ย. 2024

ความคิดเห็น • 220

  • @codebreakthrough
    @codebreakthrough  ปีที่แล้ว +6

    Check out the hands on guide - th-cam.com/video/u5AH2Wn6h1o/w-d-xo.html
    Get notified of my upcoming C/C++ Courses - www.codebreakthrough.com/upcoming-c-cpp-courses

  • @bluerie._.3021
    @bluerie._.3021 3 ปีที่แล้ว +241

    I thought of an analogy for when you would use pointers:
    Say you ask a friend to do something regarding an essay you have on an online cloud (calling a function), but to do so, you would need to send them the essay (the arguments). You can either:
    1. Send them a copy of the essay via email/message. This would give them the essay as it was when you sent it, and any changes will not transfer between versions. This means that you and your friend would only be able to see each other's essays if you were to directly communicate with each other.
    2. Send them a link to the spot in the cloud where the essay is in the cloud. The link itself wouldn't be the essay, but they would be able to find the essay by following the link and any changes made by either you or your friend will be visible to anyone that looks at the essay.
    Option 1 would be like directly inputting the variable, while option 2 would be like using a pointer.
    Is this right?

    • @MrBloodman123
      @MrBloodman123 3 ปีที่แล้ว +20

      Nice analogy,well explained.

    • @Dazza_Doo
      @Dazza_Doo ปีที่แล้ว +4

      so... DropBox ?

    • @Mr.Legend_9
      @Mr.Legend_9 4 หลายเดือนก่อน

      That's the confusing part with reference

  • @slavsquatsuperstar
    @slavsquatsuperstar 3 ปีที่แล้ว +371

    I love how casually this guy speaks. Almost like a friend sharing notes :)

  • @Theanine3D
    @Theanine3D ปีที่แล้ว +2

    I've been struggling with understanding pointers in my C++ course, but your explanation made so much more sense! Thank you!

  • @anastasiak8589
    @anastasiak8589 3 ปีที่แล้ว +2

    Great help in understanding pointers! Thanks Caleb.

  • @n.lwhitaker572
    @n.lwhitaker572 3 ปีที่แล้ว +3

    Hallelujah for this man. Fighting the good fight

  • @MehrdadKarami-x9w
    @MehrdadKarami-x9w 10 หลายเดือนก่อน

    Good job on explaining it. Thank you very much. Rock on!

  • @apollosun2913
    @apollosun2913 2 ปีที่แล้ว

    Good, good, good. The book I was learning from told about assigning and dereferencing with * but never said anything about using *x , for example, by just referring to x. Now I know. Also, this video made me feel mad clever, like one of those beautiful mind guys writing nifty equations on a chalk-board that nobody else can understand.

  • @elliotdowney9915
    @elliotdowney9915 3 ปีที่แล้ว +1

    Bless you Caleb!

  • @Lin_The_Cat_
    @Lin_The_Cat_ 2 ปีที่แล้ว

    Just *had* to subscribe after that pointers pun.

  • @0x80O0oOverfl0w
    @0x80O0oOverfl0w ปีที่แล้ว

    Nice video man. One thing I had a question about but didn't hear you mention, is the pointer an int because it's a memory address or because it's pointing to an int? In other words, if your original variable was something other than an int would the pointer change or would it still be an int? I was a bit confused on that aspect. Cheers.

  • @222ableVelo
    @222ableVelo 3 ปีที่แล้ว +5

    This guy just explained pointers the best I've ever heard it explained...........
    and I'm still confused. lol Whoever was the architect of doing it this way in the beginning needs to be tarred and feathered.

  • @kristiantorres1080
    @kristiantorres1080 2 ปีที่แล้ว

    subscribed right after the pointers joke

  • @DragonRazor9283
    @DragonRazor9283 3 ปีที่แล้ว +1

    Thanks!

  • @earthian2777
    @earthian2777 2 ปีที่แล้ว

    Thanks for the pointers

  • @maxim25o2
    @maxim25o2 3 ปีที่แล้ว

    You are great teacher!

  • @MarvelousLXVII
    @MarvelousLXVII หลายเดือนก่อน

    Great stuff.

  • @DroopNasty
    @DroopNasty 2 ปีที่แล้ว

    Hey Caleb, hope you're doing well my dude

  • @raymoseley9501
    @raymoseley9501 ปีที่แล้ว

    I slapped it!

  • @ioannaathineos5269
    @ioannaathineos5269 8 หลายเดือนก่อน

    stunning!!

  • @mordicai4296
    @mordicai4296 3 ปีที่แล้ว

    I love you Caleb!

  • @qemmm11
    @qemmm11 9 หลายเดือนก่อน

    Thanks 🫡

  • @isaacajiza4879
    @isaacajiza4879 ปีที่แล้ว

    Good job

  • @nobody-tw3zs
    @nobody-tw3zs 10 หลายเดือนก่อน

    You da best!

  • @BluetonicUK28
    @BluetonicUK28 2 ปีที่แล้ว

    Superb

  • @petersam5300
    @petersam5300 2 ปีที่แล้ว

    So good

  • @klazzera
    @klazzera ปีที่แล้ว

    8:20 I was gonna do that

  • @mishetohey5322
    @mishetohey5322 3 ปีที่แล้ว

    OMG! THANKSSS

  • @p20ph37
    @p20ph37 3 ปีที่แล้ว

    I have that same shirt.

  • @about2mount
    @about2mount 6 หลายเดือนก่อน

    There are no uses for Pointers in programming. Simply use references when passing to void functions instead.
    Also if you do not free or delete your pointers their address is locked in the memory free space preventing other programs access to that memory space.
    So if your machine stores many pointers or repeated pointers that use a different address of these locked addresses they will build up and it will crash and this is exactly why Chrome crashes.
    They can run you out of memory.

  • @chadtop9920
    @chadtop9920 2 ปีที่แล้ว

    tomorrow i will fail, but this channel will be the reason why next semester i will pass

  • @BestofBadminton
    @BestofBadminton 2 ปีที่แล้ว

    P-P-Pointers taken

  • @ameeraattiah5647
    @ameeraattiah5647 2 ปีที่แล้ว

    hi

  • @akshatvats7992
    @akshatvats7992 4 ปีที่แล้ว +2

    Real programers call the asterisk 'star'

    • @codebreakthrough
      @codebreakthrough  4 ปีที่แล้ว +10

      Really real programmers call it capital 8.

    • @akshatvats7992
      @akshatvats7992 4 ปีที่แล้ว

      @@codebreakthrough In Python 4, '8'.upper() will return *

    • @umarhasnain7369
      @umarhasnain7369 3 ปีที่แล้ว

      @@akshatvats7992 Is it 3.9 maybe? Just came recently.

    • @akshatvats7992
      @akshatvats7992 3 ปีที่แล้ว

      @@umarhasnain7369 It must be in like ultra-beta. Because otherwise I would have received it while updating my system.

  • @favour5442
    @favour5442 2 ปีที่แล้ว

    Me wondering if you really use left hand to write or your just showing off your left hand skill😏

  • @meera.9404
    @meera.9404 ปีที่แล้ว

    Hi Bucky , 😂

  • @waliky2002
    @waliky2002 2 ปีที่แล้ว

    The most confusing part of C++ along with dynamics arrays.

    • @exhydraboy2429
      @exhydraboy2429 8 หลายเดือนก่อน

      What's confusing? It's just people don't know how to explain what it does

  • @Xx_EL_xX
    @Xx_EL_xX 2 ปีที่แล้ว

    *doesn’t know the word to describe digits for hexadecimal*
    …then says these numbers aren’t significant. How close can you get hahah

  • @gideon7154
    @gideon7154 3 ปีที่แล้ว +1

    that pun almost made me press dislike, never mind the video was amazing

  • @charicner
    @charicner ปีที่แล้ว

    lifesaver, Pearson's textbook is trash

  • @sendlocation8476
    @sendlocation8476 2 ปีที่แล้ว

    Confusing as crap

  • @Dubov1933
    @Dubov1933 2 ปีที่แล้ว

    bad explanation

  • @hasangambarov711
    @hasangambarov711 2 ปีที่แล้ว

    disliked ur video because of ur joke!!!!!!!

  • @CodeSadhu
    @CodeSadhu 3 ปีที่แล้ว +222

    Goddamn you explained this so wonderfully in 15 mins that my professors couldn't in an entire semester lol

    • @AdamMohamed-cq9fv
      @AdamMohamed-cq9fv 3 ปีที่แล้ว +10

      literally very fucking true

    • @shivangm24
      @shivangm24 3 ปีที่แล้ว +4

      Yes

    • @humann5682
      @humann5682 2 ปีที่แล้ว +4

      Almost as though a lot of CS professors aren't always sure of what they are teaching....almost lol!

    • @cheesypizzajokes
      @cheesypizzajokes 2 ปีที่แล้ว

      @@humann5682 or just dont care

    • @asmallguy6124
      @asmallguy6124 2 ปีที่แล้ว

      @@humann5682 wow didn't know this was common until now lmao.

  • @kevinsuckiel4885
    @kevinsuckiel4885 4 ปีที่แล้ว +86

    Finally! Big help for me right now during my class. Thanks dude.

  • @liminal6823
    @liminal6823 3 ปีที่แล้ว +8

    int* x seems more readable to me than int *x - it makes it more clear that it's an "int-pointer" ie. its own type, distinct from int. I know there all kinds of arguments about this but I don't care because I'm always right.

    • @n00blamer
      @n00blamer 2 ปีที่แล้ว

      I'm with you on this one, all the arguments are blah blah blah multiple variables blah blah.. we're just right it's that simple. :)

  • @bradizawsome
    @bradizawsome 3 ปีที่แล้ว +16

    You should seriously be a professor or something. You literally made this so much easier for me to understand and you're the only TH-camr I can find that teaches before coding which is why I only watch your videos lol

  • @Danieldxc666
    @Danieldxc666 3 ปีที่แล้ว +17

    Holy... My professor could never explain this so smoothly in half a semester. Thank you!

  • @spacemangalaxy7932
    @spacemangalaxy7932 3 ปีที่แล้ว +12

    I don't want to say other lessons bad, it's the best of 5 which I saw about pointers in recommends, and... really understand what it is and how to use it after watching. But, why is here low number of likes, not even 500. Everyone, put likes, this lesson deserves it!

  • @ciaspo
    @ciaspo 3 ปีที่แล้ว +41

    Caleb, you figure out what might be difficult to understand and you explain it very clearly. You are a great teacher, keep up the good work! Thank you very much :)

  • @Squash101
    @Squash101 ปีที่แล้ว +4

    Certainly the best video on pointers, I wish more people taught concepts like this, rather than just showing a bit of code and syntax

  • @alexandermilleriii499
    @alexandermilleriii499 3 ปีที่แล้ว +3

    4:09 As if Hexadecimal "numbers" makes sense lol... hex includes letters. I would just say hexadecimal characters...

    • @codebreakthrough
      @codebreakthrough  3 ปีที่แล้ว +2

      Well in hex A-F would be numbers not characters. All kinds of confusing 😉

    • @vlogtomejr.1919
      @vlogtomejr.1919 3 ปีที่แล้ว

      I suppose the term "numerals" is likely most appropriate for this context.

  • @mrboyban
    @mrboyban 3 ปีที่แล้ว +7

    Hey Caleb, thanks for make this content available,I'm feeling less dumb now.

  • @gaurishagrawal9404
    @gaurishagrawal9404 3 ปีที่แล้ว +6

    I dont know why, but even though C++ is harder...typing it is so much more satisfying .....atleast for me.

  • @imagidan
    @imagidan 3 ปีที่แล้ว +2

    Thanks for the pointers LMAO

  • @AleCat97
    @AleCat97 2 ปีที่แล้ว +4

    awesome! in my class they are teaching us about pointers and new, delete, null, which seems like the old and harder way of doing things, but thanks for mentioning it in your video! most ppl skip it because its not used frequently but when we have to follow a curriculum from univ is hard to avoid and find info about those. thank u!

  • @kenheisenberg5223
    @kenheisenberg5223 ปีที่แล้ว +1

    This guy is so funny. And very well explained a very difficult and confusing subject.

  • @WilsonLee123
    @WilsonLee123 3 ปีที่แล้ว +6

    The pointer pun 👌 LOL

  • @ericvt
    @ericvt 2 ปีที่แล้ว +3

    been trying to understand this since i was in university. you explained it more clear than my profs lol

  • @DarkReaperK97
    @DarkReaperK97 ปีที่แล้ว +1

    Thanks for uploading. Pointers are terrifying for(almost) every student learning C++.

  • @wilbertraymundrayos4175
    @wilbertraymundrayos4175 4 ปีที่แล้ว +5

    Finally, the video/topic I've been waiting for

  • @fernm2861
    @fernm2861 28 วันที่ผ่านมา

    @8:27 "c programming... disgusting..." I'll repeat that after you as many times as you want! 🙂 But seriously, I love the way you teach!

  • @nickdgreat6741
    @nickdgreat6741 3 ปีที่แล้ว +6

    Great video, really helped me get a handle on the concept while keeping it interesting. Thanks for the help and keep doing you bro!

  • @fortouph
    @fortouph 5 หลายเดือนก่อน

    I like that you use a white board, I've had difficulties following other coding teachers on youtube who only use the IDE while talking about these topics. I find the whiteboard much easier to follow possibly because I'm a visual learner. You also do an amazing job dumbing down concepts that makes them easier to understand.

  • @ralphramirez7504
    @ralphramirez7504 7 หลายเดือนก่อน

    My professor constantly reminds us that he has a doctorate masters wizard of oz Jedi degree in computer science and yet Caleb here, explains pointers way better than his bald a$$. Thank you, Caleb.

  • @benlambert8481
    @benlambert8481 5 หลายเดือนก่อน

    You just made pointers click. it's a type of it's own, just like an 'int' or a 'string'. Rather than putting 'int' the pointer variable is * with a prefix of what variable it is your pointing to... The you give it a name and assign it to the variable you're pointing too.

  • @nicholascunningham6936
    @nicholascunningham6936 2 ปีที่แล้ว

    "Only use pointers when you have to!"
    My professors giving me starter code for an assignment: I'm gonna pretend I didn't see that
    Me, who hasn't touched C++ all summer: tf does this asterisk do again?

  • @Eddy-ly2ml
    @Eddy-ly2ml ปีที่แล้ว +3

    8:27 was the point of no return where i crossed into learning about pointers all thanks to you Caleb! I love your explanation videos! Thank you for making teaching and explaining these concepts!

  • @oisinfeeney3471
    @oisinfeeney3471 4 ปีที่แล้ว +5

    Cheers lad, these videos are a great help for uni

  • @calebfurley3784
    @calebfurley3784 11 หลายเดือนก่อน

    At the end of the video you started firing them little neurons I got, then said “but let’s not get into the weeds we’ll just stop here” 😭 good video though, I wanna move from Java to c++ and this was one of the first videos I watched, so thanks.

  • @rhysrittgers2183
    @rhysrittgers2183 5 หลายเดือนก่อน

    I hope you are making millions off these videos because you are helping millions. If you started a goFundMe and asked all your viewers to donate a dollar we would all do it and you would be rich

  • @CapitalCH
    @CapitalCH 11 หลายเดือนก่อน

    thank you for posting. i did not understand and my professor hardly explained it.

  • @trumbaron
    @trumbaron ปีที่แล้ว

    int x = 5
    int *p = &x (adress of)
    x = 5
    &x = 0x5ffe94 (some adress in memory)
    p = 0x5ffe94
    *p = 5

  • @juniornyembe4841
    @juniornyembe4841 3 ปีที่แล้ว +1

    i'm 22 seconds into the video and ive already clicked the like button and subscribed, only from that Pointer joke. amazing

  • @MikeMcRoberts
    @MikeMcRoberts 2 ปีที่แล้ว

    6:02 confusing! It is * not ptr 6:07 confusing! Beginners will think you have to use the variable names X and Y

  • @a_boy_can_dream
    @a_boy_can_dream ปีที่แล้ว +1

    You explain things really well. Subbed!

  • @lemmiix
    @lemmiix 4 หลายเดือนก่อน

    watched like 10 videos about pointers. That's the one that made me understand how and why use pointers

  • @greywolf271
    @greywolf271 2 ปีที่แล้ว +1

    I learnt more about pointers after learning C from the K&R textbook and Michael Daconta's C++ Pointers and Dynamic Memory Managements. Kernighan and Ritchie explain pointers very well and Daconta's book is highly recommended for furthering your knowledge.

  • @ryancarney7616
    @ryancarney7616 ปีที่แล้ว +1

    I was really confused about the meaning of the asterik when using pointers, and how it can be used in a couple different ways. This video really helped clear that up. Thanks!

  • @tabletalenovo9695
    @tabletalenovo9695 ปีที่แล้ว

    9:10 then why not just write int* y = &x and then cout

  • @TheSimplyJJP
    @TheSimplyJJP 22 วันที่ผ่านมา

    Why the heck is it always the youtube videos that make sense and not the professors.

  • @BlackMantisRed
    @BlackMantisRed 2 ปีที่แล้ว +1

    I heard someone say you needed points to program a game, I had him explain to me what pointers are but I didn’t understand it or why I would need it, thanks for the great video

  • @TheRawi
    @TheRawi ปีที่แล้ว

    I wish you used a whiteboard instead of using a chalkboard...

  • @larrym1983
    @larrym1983 2 ปีที่แล้ว +1

    Oh my god! I luv your explanation of pointers! My professor at school is so confusing so I had to go to youtube to find a better explanation. Your video at explaining pointers is very clear!

  • @pervbirdmusic
    @pervbirdmusic 3 ปีที่แล้ว +3

    "Alright, let's learn how to use pointers!"
    "Use references instead."
    "Aight, cool."

  • @Silvertestrun
    @Silvertestrun 11 หลายเดือนก่อน +1

    Thank you!

  • @HeatherHolt
    @HeatherHolt 7 หลายเดือนก่อน

    like given just for the pun at the beginning

  • @dawg6408
    @dawg6408 7 หลายเดือนก่อน

    1 year after high school i'm finally kind of understanding

  • @cclemon2531
    @cclemon2531 11 หลายเดือนก่อน

    thx for helping me learning pointer please continue create more tutorial video!!

  • @johnnamtae9610
    @johnnamtae9610 3 ปีที่แล้ว +2

    Caleb wazzzzup brothaaaaaaa!

  • @Joe-qp1ow
    @Joe-qp1ow 4 ปีที่แล้ว +2

    You are smart and cute. Haha

  • @varcel4625
    @varcel4625 2 ปีที่แล้ว

    Getting a like for the comments you did. LOL :D

  • @NoSpeechForTheDumb
    @NoSpeechForTheDumb 2 หลายเดือนก่อน

    Pointer in C: int *p
    Pointer in C++: std::unique_ptr p

  • @fenfire3824
    @fenfire3824 3 ปีที่แล้ว +7

    Pointers are great for "hacking" other software, if it does not have an api. You can find out the memory addresses and read the data of other stuff and use it in your own software. Pretty sure it is violating some policys in a way, but sometimes it is an unfortunate necessarity. It is basicly the same as using cheat engine. Said differently, you can use a tool like cheat engine to find out memory locations and use this in your programs for whatever you need it.

  • @NorthernWind_Vlll
    @NorthernWind_Vlll 3 ปีที่แล้ว

    Location of this nigga, right here, i died xD

  • @kristiantorres1080
    @kristiantorres1080 2 ปีที่แล้ว

    Where's the second part? Amazing video

  • @LorenzoMezzabarba
    @LorenzoMezzabarba ปีที่แล้ว

    pointer are way easier that i thought, nothing compare to recursion

  • @SebleBeyene-jp8hp
    @SebleBeyene-jp8hp 5 หลายเดือนก่อน

    I feel sorry when i didn't laugh 😂😂😂

  • @LowLevelStudio
    @LowLevelStudio 6 หลายเดือนก่อน

    Just try combination of & and * until it works

  • @williamblair1123
    @williamblair1123 3 ปีที่แล้ว +1

    "hexadecimal 'characters' "