Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Pushing around things on the stack  (Read 2786 times)

0 Members and 2 Guests are viewing this topic.

Cyrano

  • Newbie
  • *
  • Posts: 19
    • View Profile
Pushing around things on the stack
« on: April 22, 2010, 07:07:09 pm »
Another question:

After seeing this: (http://gamedevgeek.com/tutorials/managing-game-states-in-c/), I noticed that the author of the article mentioned "pushing and popping" objects  on the stack. What does that mean? How is it accomplished?

From what I understand, the stack is part of the memory used by the program, and objects can be loaded into it. When an object is "pushed" it moves up or down on the stack, right?

Thanks again!

-Cyrano
– A cape? Forsooth! 'Tis a peninsula!

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Pushing around things on the stack
« Reply #1 on: April 22, 2010, 07:25:48 pm »
In that article stack is a datastructure


I'm guessing that you must be very new to programming in general as that's a fairly basic concept.

Cyrano

  • Newbie
  • *
  • Posts: 19
    • View Profile
Pushing around things on the stack
« Reply #2 on: April 22, 2010, 11:04:45 pm »
Quote from: "Breakman79"
In that article stack is a datastructure


I'm guessing that you must be very new to programming in general as that's a fairly basic concept.


Correct you are! I am a beginner, yes, but I'm not totally stupid. I'm asking questions to fill in the gaps in my knowledge.

I can write a perfectly good program that runs, start to finish, but I'm afraid that the books I read on C++ did not heavily cover datastructures. Anything I know about those has come from reading articles and examining other people's code.


Thanks for the article. I was already familiar with the concept of the linked list and the array, but I wasn't 100% sure what the term "stack" meant. Now I know.

-Question answered! Thanks!

-Cyrano
– A cape? Forsooth! 'Tis a peninsula!

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Pushing around things on the stack
« Reply #3 on: April 22, 2010, 11:30:38 pm »
No problem.  Sometime you should take a look at the C++ Standard Template Library.  Many useful and time saving classes for building data-structures.  

Here's a tutorial site

Cyrano

  • Newbie
  • *
  • Posts: 19
    • View Profile
Pushing around things on the stack
« Reply #4 on: April 23, 2010, 05:47:16 am »
Quote from: "Breakman79"
No problem.  Sometime you should take a look at the C++ Standard Template Library.  Many useful and time saving classes for building data-structures.  

Here's a tutorial site


Thanks for the link. I'm already familiar with the STL, and use it frequently.

In retrospect, I probably should have read the 'ol "C++ for Dummies" a little more thoroughly in the data structure sections. :roll:

-Cyrano
– A cape? Forsooth! 'Tis a peninsula!

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Pushing around things on the stack
« Reply #5 on: April 23, 2010, 06:15:21 am »
Ahh, ok.  Sorry, I wasn't sure how familiar you were with the C++ language in general.

 

anything