Results 1 to 11 of 11

Thread: Pointers in C++

  1. #1

    Question Pointers in C++

    Okay so in my C++ book I've gotten to the part about arrays, structures, unions, and then... pointers.
    I'm having trouble understanding how pointers are assigned, and what assigning ways are illegal (like assigning and address to an int type?) So before I go to the section about new, could anyone help explain to me in simple terms how pointers work? (I've taught myself HTML and CSS, and JavaScript, but I haven't been practicing so I may have forgotten em. I can understand programming terms).

  2. #2
    Master Sorcerer |ThyLuigi|'s Avatar
    Join Date
    Dec 2014
    Location
    Alpha Centauri
    Posts
    8,191

    Default

    http://stackoverflow.com/questions/7...ter-assignment

    Stackoverflow.com is generally a good place for programming questions.
    "It vexes me how veracious discussion actually devolved into what literally is nocuous as a brainwashed drove of cattle spamming the only two words in their vocabulary: forum game." - JOSHIE63, 2017

    ↓↓↓
    IGN:TheLuigi
    ↑↑↑

  3. #3

    Default

    Thanks! That makes it easier to understand.

  4. #4

    Default

    Just one more thing. If we have 2 variables, int x, int *xx, with x = 24 and *xx = &x, how does *xx have the same value as x? I went on a compiler to see what each one prints out, and the results were

    x =24
    *xx=24
    &x = (some huge hexadecimal value)

  5. #5
    Master Sorcerer |ThyLuigi|'s Avatar
    Join Date
    Dec 2014
    Location
    Alpha Centauri
    Posts
    8,191

    Default

    Quote Originally Posted by Boise View Post
    Just one more thing. If we have 2 variables, int x, int *xx, with x = 24 and *xx = &x, how does *xx have the same value as x? I went on a compiler to see what each one prints out, and the results were

    x =24
    *xx=24
    &x = (some huge hexadecimal value)
    Well, what is the * in *xx? It could have something to do with it...sorry, the only language ik is Ruby.
    "It vexes me how veracious discussion actually devolved into what literally is nocuous as a brainwashed drove of cattle spamming the only two words in their vocabulary: forum game." - JOSHIE63, 2017

    ↓↓↓
    IGN:TheLuigi
    ↑↑↑

  6. #6

    Default

    lol... * dignifies a pointer. I appreciate your help, but I think a person who knows C++ can help me more.

    - - - Updated - - -

    Btw, don't limit yourself to ruby. More languages you learn, the easier they are to pick up

  7. #7
    Master Sorcerer |ThyLuigi|'s Avatar
    Join Date
    Dec 2014
    Location
    Alpha Centauri
    Posts
    8,191

    Default

    Quote Originally Posted by Boise View Post
    lol... * dignifies a pointer. I appreciate your help, but I think a person who knows C++ can help me more.

    - - - Updated - - -

    Btw, don't limit yourself to ruby. More languages you learn, the easier they are to pick up
    I'm planning to learn more languages, next being Javascript.
    "It vexes me how veracious discussion actually devolved into what literally is nocuous as a brainwashed drove of cattle spamming the only two words in their vocabulary: forum game." - JOSHIE63, 2017

    ↓↓↓
    IGN:TheLuigi
    ↑↑↑

  8. #8

    Default

    Quote Originally Posted by Boise View Post
    Just one more thing. If we have 2 variables, int x, int *xx, with x = 24 and *xx = &x, how does *xx have the same value as x? I went on a compiler to see what each one prints out, and the results were

    x =24
    *xx=24
    &x = (some huge hexadecimal value)
    I figured it out.
    *xx is equal to x, and
    xx (without pointer dignifier) is equal to &x


    Thanks anyways

  9. #9
    Master Sorcerer MyLegGuy's Avatar
    Join Date
    Mar 2014
    Location
    United States
    Posts
    1,631

    Default

    Just a heads up, this game development forum is pretty much dead.
    If you want better help, you should head elsewhere.

    I think one guy here knows C++.
    And I have not seen him post in ages.

  10. #10

    Default

    Lol I can tell. Well thanks.

  11. #11
    Master Sorcerer |ThyLuigi|'s Avatar
    Join Date
    Dec 2014
    Location
    Alpha Centauri
    Posts
    8,191

    Default

    Quote Originally Posted by Boise View Post
    Lol I can tell. Well thanks.
    I'd recommend that stack overflow website, it has millions of people answering questions about all kinds of programming languages.
    "It vexes me how veracious discussion actually devolved into what literally is nocuous as a brainwashed drove of cattle spamming the only two words in their vocabulary: forum game." - JOSHIE63, 2017

    ↓↓↓
    IGN:TheLuigi
    ↑↑↑

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •