Wrox Press C++ Tutorial
You are now familiar with all of the basic types of values in C++, how to create and use arrays of those types and how to create and use pointers. You have also been introduced to the idea of a reference. However, we have not exhausted all of these topics. We'll come back to arrays, pointers and references again later on. The important points that we have discussed in this chapter are:
const, in which case it can't be reassigned.sizeof returns the number of bytes occupied by the object specified as its argument. Its argument may be a variable or a type name between parentheses.new allocates memory dynamically in the free store. When memory has been assigned as requested, it returns a pointer to the beginning of the memory area provided. If memory cannot be assigned for any reason, a NULL pointer will be returned. Memory allocated by new can only be freed using the delete operator with the address originally returned by new as an argument.The pointer mechanism is sometimes a bit confusing because it can operate at different levels within the same program. Sometimes it is operating as an address, and at other times it can be operating with the value stored at an address. It's very important that you feel at ease with the way pointers are used, so if you find that they are in any way unclear, try them out with a few examples of your own until you feel confident about applying them.