Buckys C++ Programming Tutorials – 41 – Pointers and Math

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

39 responses to “Buckys C++ Programming Tutorials – 41 – Pointers and Math”

  1. aditya kiran Avatar

    why does Bucky sound a lil like Ross from friends 😀

  2. blackneos940 Avatar

    As always, thanks for the tutorials, Bucky….. 😀 Man, Caffeine is starting to make me TIRED….. Better abstain for a while….. :3

  3. Jose Gonzalez Avatar

    Thanks, you taught me something I probably would not have known. I really appreciate your work!

  4. Cathy Zeng Avatar

    I ran the same code three times. The storage address keeps changing. Could someone explain to me why?

    bp0 is at 008FF8F8
    bp1 is at 008FF8FC
    bp2 is at 008FF900
    bp0 is now at 008FF900

    bp0 is at 00BFFDB8
    bp1 is at 00BFFDBC
    bp2 is at 00BFFDC0
    bp0 is now at 00BFFDC0

    bp0 is at 00AFFDA0
    bp1 is at 00AFFDA4
    bp2 is at 00AFFDA8
    bp0 is now at 00AFFDA8

  5. Jahanzaib Shahid Avatar

    what the hack is going man ???

  6. molnez Avatar

    Super nice tutorials. Thank you very much, Just one small thing @1:10; Saying "bp0 is at " print(bp0) is misleading since it implies that you are printing the address of bp0. The address of bp0 is &bp0. The text should really say "bp0 points to address: " print(bp0), or "The address of the first element in "bucky" array is" print(bp0).

    I have a little bit of experience coding in C, I'm mostly watching for the higher level C++ stuff. Really like the format of super short and concise videos by the way:)

  7. Mark Ross Avatar

    instead of int array can you do char array? I tried it, it doesnt work? why is this?

  8. juustgowithit Avatar

    usual teacher: explains shittily, moves on like it's fine
    bucky: explains perfectly the first time, still tries to phrase it in as many ways as possible to be clear

  9. Cansın Memiş Avatar

    Wow that is really a great tutorial. I couldn't stop and I watch all the series until this. I learnt lots of useful tricks! Is there a donation channel or something to support this?

  10. fullthrottle254 Avatar

    how do i set an account on the forum for your website? i can find a sign in or new member hyper link

  11. Seanohaha Avatar

    So I copied your code and tested it for all 6 elements and something strange happens, after bp2, it says that the memory address for bp3 ends in c, then for bp4 it starts at 0 again, then bp5 is 4…Is this supposed to happen? I thought it would just increment by 4 continuously?

  12. Pete the Paper Boat Avatar

    64Bit Ram Addresses are longer . I guess that's why they can hold more addresses at the same time.

  13. stezz the haxor Avatar

    5 years later and you are still making nerd lifes easier

  14. smbossco Avatar

    I like to think of it as moving two addresses down, rather than adding a number two in a mathematical sense.

  15. void Avatar

    But what is the point of pointers? The pointer has the same value of the address its pointing to.

  16. Gabriel Santos Avatar

    The BEST tutorial about this that I've ever seen, I'm Brazilian but I understood your tutorial very clearly, all the other tutorials that I watched don't explain like yours, I was about to been crazy with this pointers and you made me get this, thanks a lot man!

  17. Gerald Joshua Avatar

    I think it would be more appropriate to say that the pointer bp0 has a value of 0x28ff00, since the pointer bp0 has its own memory address (Simply just use this statement to know the memory address of the pointer bp0: cout << &bp0;)

  18. ziad hassan Avatar

    but I didn't understand why when he print bp0 out the first time it said "ff08" not "ff00" ,can you please guys explain it for me?? ^_^

  19. Kevin MinKue Kim Avatar

    After bp0 +=2, can I understand that bp0 = bp2, because they have same memory address, 28ff08? Or do they just point same memory address?

  20. Eyal Pery Avatar

    Saying "next element" is not accurate because what if we are not handling an array?
    A different explanation:
    bp0 += 2 means increment of "2" in memory => 2*sizeof(pointer type) => 2*sizeof(int) => 2*4 = 8
    This is why memory 00 became 08.

    Test your understanding:
    if bp0 was double and not int, then +2 will be?….. 2*8 = 16 => memory of 00 will become 16 (and not 8)

  21. Manny T Avatar

    man ..Bucky, if you can explain pointers in 5 minutes, imagine what you could lecture in 2 hours. Most professor cant help students understand in 1 hour…

  22. John Wayne Avatar

    I am actually getting what pointers are for. Thanks Bucky. At first, it seemed to me like black magic. Now I cannot imagine my programs without pointers.

  23. Cody Aldaz Avatar

    I've been watching these videos (1-40) at 2x speed but slowed the video down to normal speed for this video. It was shocking at first.

  24. steve122288 Avatar

    it looks like it doesn't just point to the address of the next element, rather it just points where the next element would be in memory, based on how many bytes of memory is reserved for that data type in the array. As i noticed, an integer pointer +1 will move 4 bytes ahead in memory, where a double pointer will move 8 bytes ahead in memory . So effectively when you add to the memory address of a non array, it will move based on the amount of bytes reserved for that data type. So its almost like saying address of variable + 1 reserved bytes ). Or perhaps even &variable + sizeof(variable); Only problem there, is that it would return &variable+4 .. haha (assuming 4 bytes).. Which isn't what u want.

  25. steve122288 Avatar

    hmm he shoulda gone on with the memory addresses; cuz after 24 came 28 but then came 2c and then 30. So he probably should have mentioned something about how memory addresses do or don't work. .. Speaking of which, where's Bucky's tutorials on binary and hex?!

  26. Orel Zilberman Avatar

    it actually changes to 08 because each address is 4 bytes in c++, therefore if you say +2, the compiler will take it to 2 ""steps"" and place it in address 08.

  27. Christopher Jones Avatar

    main() {8 == D -> (. )( .) }

  28. billyblackburn87 Avatar

    Again im thinking….whats the point of pointers?

  29. James R Avatar

    "i'm lovin' it!" – my thoughts on this tutorial

  30. Batman Avatar

    so we can't change the memory address its not depend on us its depend on our pc gotcha and the pointer only point at the memory address its only work is to point on memory address of that specific variable and if we add something in that variable our complier think we are pointing on a different variable and it will show the memory address of that other variable guess wat I got it finally maybe!!

  31. Mohamed Sherif Avatar

    I have a question!
    If there is 3 ints stored at bucky[0] [1] [2],why it didnt show  ff012?4*3.

  32. Jonét ジョネー Avatar

    My numbers keep changing when I run it. I get a string of random 8 digit numbers each time, for each bp variable.

Leave a Reply

Your email address will not be published. Required fields are marked *