Thread: Structures? *brain melts*

  1. #91
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    In low level terms pointers point to addresses. The value at the address is what we want, and sometime we want the actual address.

    Think of memory as a bunch of mailboxes. The value is what's in the mailbox and the address is the number of the mailbox.

    That prob sucked but its all I could come up with.

  2. #92
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Originally posted by MrDoomMaster
    I would hit the people that say a "bubba" is some fat scary gay dude in jail waiting for newcomers... absolute nonsense!

    Bubba actually tends to be an experienced programmer... not a fat guy in a jail cell!
    Who ever said he was a fat prisoner?? Hes just a scary dude that dubbed himself a convert to assembler......
    Do not make direct eye contact with me.

  3. #93
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I can't figure out why the IRC channel never became popular

    It would be great fun if we could get everyone to participate
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #94
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    By the way, int func(int & x) does not pass a pointer, it passes a reference. Normally the & symbol gives us the address of a variable, but in this case it's a reference. This means that manipulating x within the function does the exact same thing as manipulating the original variable that was passed.
    Code:
    void add(int &a, int b)
    {
         a+=b;
    }
    
    int main()
    {
        int x=7;
        add(x,5);
       return 0;
    }
    x ends up with the value 12.
    Last edited by bennyandthejets; 11-01-2003 at 06:19 PM.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  5. #95
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    If we put this on the FAQ board, everyone would be confused.

    Then we'd have questions about questions on the FAQ board.


  6. #96
    Registered User MrDoomMaster's Avatar
    Join Date
    Oct 2003
    Posts
    53
    I will eventually get to writing my own code, but before I start using a certain aspect of the language I want to understand 2 basic things:

    1. syntax
    2. how the entire thing functions, and what each specific part does.


    I'm not asking you guys to do the code for me, I'm just trying to understand the specifics!

    For example, lets say you buy a new car... You learn where the break is, and you learn where the acceleration pedal is. The object is to be able to SUCCESSFULLY drive the vehicle. So, you get in, and realize you don't know where the keyhole is for the ignition. How can you expect to drive the car if you don't know the specifics? Knowing where the break and acceleration won't help you if you don't know how to turn the car on!

    Stupid example, sure, but humor me
    --MrDoomMaster
    The kind of DooM that makes the MooD

  7. #97
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Originally posted by MrDoomMaster
    how the entire thing functions, and what each specific part does.
    If Jawib keeps "helping", this thread might end up showing you how all of C++ does work!
    Do not make direct eye contact with me.

  8. #98
    Registered User MrDoomMaster's Avatar
    Join Date
    Oct 2003
    Posts
    53
    Originally posted by Bubba
    In low level terms pointers point to addresses. The value at the address is what we want, and sometime we want the actual address.

    Think of memory as a bunch of mailboxes. The value is what's in the mailbox and the address is the number of the mailbox.

    That prob sucked but its all I could come up with.
    actually it's pretty good... so, with a pointer, you can always keep up with what information is at that address, even though the variable using that information may change, the pointer will always keep up with what information is at THAT address?

    Kinda simple
    --MrDoomMaster
    The kind of DooM that makes the MooD

  9. #99
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    But you don't have to know the internal workings of the engine to be able to drive the car either.

    If you are waiting to code until you fully understand C/C++ you will be waiting for a very long time.

    Jump in and crash the system a few times....it's quite humbling.

  10. #100
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    So do you understand this now, or are you still confused about something?
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  11. #101
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    You need to start coding soon. You can't really learn without practical experience.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  12. #102
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Originally posted by Bubba

    Jump in and crash the system a few times....it's quite humbling.
    I need a new sig - think i can borrow that?


    I crashed my computer with my second pointer program, so don't worry too much about it right now doom.
    Do not make direct eye contact with me.

  13. #103
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    And we cannot obviously explain every facet of the language in one post...although its been fun trying.

    Try to write some code and when it fails...cuz it will...bring it here and we will help.

  14. #104
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    .. need a new sig - think i can borrow that?

    Sure.

  15. #105
    Registered User MrDoomMaster's Avatar
    Join Date
    Oct 2003
    Posts
    53
    well I don't know what kind of program to write. I only know a little bit, enough for a console program. If it comes down to windows apps, I'm screwed.
    --MrDoomMaster
    The kind of DooM that makes the MooD

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  2. Structures, passing array of structures to function
    By saahmed in forum C Programming
    Replies: 10
    Last Post: 04-05-2006, 11:06 PM
  3. Input output with structures
    By barim in forum C Programming
    Replies: 10
    Last Post: 04-27-2004, 08:00 PM
  4. pointers to arrays of structures
    By terryrmcgowan in forum C Programming
    Replies: 1
    Last Post: 06-25-2003, 09:04 AM
  5. Methods for Sorting Structures by Element...
    By Sebastiani in forum C Programming
    Replies: 9
    Last Post: 09-14-2001, 12:59 PM