The blight of A____ was upon the land,
the patterns long forgotten,
and poems one could understand
from Chaucer "down" to Auden.
But some variables are immortal. These variables are declared outside of blocks, outside of functions. Since they don't have a block to exist in they are called global variables (as opposed to local variables), because they exist in all blocks, everywhere, and they never go out of scope. Although powerful, these kinds of variables are generally frowned upon because they encourage bad program design.
Posted by: Court at January 19, 2004 02:51 AMThis code should compile and run just fine, and you should see no changes in how the program works. So why did we do all of that?
Posted by: Felix at January 19, 2004 02:52 AMWhen a variable is finished with it's work, it does not go into retirement, and it is never mentioned again. Variables simply cease to exist, and the thirty-two bits of data that they held is released, so that some other variable may later use them.
Posted by: Manasses at January 19, 2004 02:52 AMThis is another function provided for dealing with the heap. After you've created some space in the Heap, it's yours until you let go of it. When your program is done using it, you have to explicitly tell the computer that you don't need it anymore or the computer will save it for your future use (or until your program quits, when it knows you won't be needing the memory anymore). The call to simply tells the computer that you had this space, but you're done and the memory can be freed for use by something else later on.
Posted by: Constance at January 19, 2004 02:52 AMEarlier I mentioned that variables can live in two different places. We're going to examine these two places one at a time, and we're going to start on the more familiar ground, which is called the Stack. Understanding the stack helps us understand the way programs run, and also helps us understand scope a little better.
Posted by: Helegor at January 19, 2004 02:53 AM