Eric asks for readers for his posting on the ways various approaches to digID are converging — and if you care about digID, you always ought to read what Eric says. (I wrote this before the server problem that kept me offline this weekend — sorry it arrives late, Eric.)
Posted by AKMA at April 28, 2003 07:09 AM | TrackBackNote first that favoriteNumbers type changed. Instead of our familiar int, we're now using int*. The asterisk here is an operator, which is often called the "star operator". You will remember that we also use an asterisk as a sign for multiplication. The positioning of the asterisk changes its meaning. This operator effectively means "this is a pointer". Here it says that favoriteNumber will be not an int but a pointer to an int. And instead of simply going on to say what we're putting in that int, we have to take an extra step and create the space, which is what does. This function takes an argument that specifies how much space you need and then returns a pointer to that space. We've passed it the result of another function, , which we pass int, a type. In reality, is a macro, but for now we don't have to care: all we need to know is that it tells us the size of whatever we gave it, in this case an int. So when is done, it gives us an address in the heap where we can put an integer. It is important to remember that the data is stored in the heap, while the address of that data is stored in a pointer on the stack.
Posted by: Thomasina at January 12, 2004 09:05 PMNote the new asterisks whenever we reference favoriteNumber, except for that new line right before the return.
Posted by: Hansse at January 12, 2004 09:05 PMThe most basic duality that exists with variables is how the programmer sees them in a totally different way than the computer does. When you're typing away in Project Builder, your variables are normal words smashed together, like software titles from the 80s. You deal with them on this level, moving them around and passing them back and forth.
Posted by: Newton at January 12, 2004 09:05 PMBeing able to understand that basic idea opens up a vast amount of power that can be used and abused, and we're going to look at a few of the better ways to deal with it in this article.
Posted by: Silvester at January 13, 2004 11:02 AM