10 Days of Basic Programming, Day 7: Pointers

Acid_Snake

I like beer.

10 Responses

  1. Anon says:

    “In the above code I allocate space enough to hold 10 integers, and I can use ptr the same way as an array: ptr[0], ptr[1], ptr[2], …, ptr[10].”
    That looks suspiciously like an array of 11 ptr’s.

    Thanks for the article, looking forward to getting closer to at least PSP in the future.

  2. Gaze says:

    I really need to re-read these after they are finished. Not that I’m a complete beginner, but mainly being self taught, I’ve missed some areas.

  3. Akabane87 says:

    Noticed some typos like “ptr[10]” and “int** ptr = %x;”, but except this the approach looks good 😉 You don’t talk about virtual mapping generrally used with any OS instead of accessing directly the physical ram but I suppose it would be more confusing than anything else (and wouldn’t bring so much).

  4. theWizard says:

    So what are you going to cover in “intermediate” programming? Complex data structures? Or are you going to start talking about lower level programming?

    • Acid_Snake says:

      Intermediate Programming will be mostly hight-level stuff; OOP, concurrency, software exceptions, generic programming, namespaces, programming techniques, etc

  5. Yatto says:

    Thanks ! I already knew this but it’s always good to re-learn it from another source. BTW I think your Basic Programming articles are very well made for a beginner !

    I would just add, regarding the pointer to structure, you may want to write this :
    struct MyStruct my_struct;
    struct MyStruct* my_ptr = &my_struct;

    my_struct.data;
    *my_ptr.data;

    But the program doesn’t know to which term the “*” refers to. So you CAN write this that way
    (*my_ptr).data;
    And it works. But since it’s complicated, when they made the language, they added the -> way. So :
    (*my_ptr).data; ===IS EXACTLY THE SAME AS=== my_ptr->data;

    Just this. (I think it’s easier to understand this way).

  1. May 1, 2015

    […] >>> Next: 10 Days of Basic Programming, Day 7: Pointers […]