Results 1 to 8 of 8

Thread: Memory,addresses and pointers

  1. #1
    Join Date
    Mar 2014
    Beans
    110

    Memory,addresses and pointers

    Hello,

    I am only a novice programmer and recently gained interest in memory, addresses, pointers and free store allocation. I have only a basic understanding of variables, operators and program structure ( I have written some simple programs).

    If I want to learn about those mentioned above, what should I master before them? Classes? Or/and something else?

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Memory,addresses and pointers

    Hi spacerocket.

    It's been a long time since I learned that, but they go together with "Data Structures and Algorithms".

    The basic data structures (or 'objects') that benefit from dynamic allocations are: lists, stacks and trees.

    I would start with either lists, or stacks. First* you create the data structure, then the basic procedures like 'init', 'add', 'remove', 'search', etc.

    Just some thoughts. Hope it helps.
    Regards.

    * alternatively, with OOP in mind, you can create the classes and its methods.
    Last edited by papibe; October 17th, 2014 at 09:23 PM. Reason: syntax

  3. #3
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,172
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Memory,addresses and pointers

    Warning: unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.

  4. #4
    Join Date
    Sep 2014
    Beans
    5

    Re: Memory,addresses and pointers

    Even the simplest of programs written in C will use most of these concepts, so I'd start with some simple C tutorials.

    And since you're on Linux, you have 2 excellent c compilers to choose from, clang or gcc.

    PS what on earth is 'free store allocation' ?

  5. #5
    Join Date
    Oct 2014
    Location
    Arkansas
    Beans
    14
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Memory,addresses and pointers

    This is another good resource for dealing with pointers.http://cslibrary.stanford.edu/102/

    As has been said data structures are a great way to get familiar with pointers. Simple lists that can grow and shrink are a very good exercise. A great tool to track down memory leaks is valgrind.

  6. #6
    Join Date
    Feb 2009
    Beans
    1,469

    Re: Memory,addresses and pointers

    Quote Originally Posted by dataformsaction View Post
    PS what on earth is 'free store allocation' ?
    "Free store" is sometimes used as a synonym for "heap". In C++, I understand it refers specifically to the memory space used for allocation with new/delete, as opposed to the heap which is used by malloc/free, but don't quote me on that. It's the same memory either way.

  7. #7
    Join Date
    Mar 2014
    Beans
    110

    Re: Memory,addresses and pointers

    Ok,

    I`m generally interested in board games, and datastructures like bitsets come in handy for those. In my book there was a some chapters about bits, but not really much. I have tried to search for online documentation and so on but I have to say that I

    understand relatively little how to use shifting operators with board games (diatgonal and horizontal search, how to use & operator with >>). Is there any book/documentation for more about that?

  8. #8
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Memory,addresses and pointers

    Since bit sets/arrays are a complete different concern, I'd recommend opening a new thread about that specific topic.

    Regards.

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
  •