Sams Teach Yourself C++ in 21 Days
216 Week 1 (4) Resize (5) Quit 3 Perimeter: 36 *** Menu *** (1) Draw Rectangle (2) Area (3) Perimeter (4) Resize (5) Quit 5 Exit ...
In Review 217 Each of the other choices, with the exception of ChangeDimensions, calls a function. This makes the switchstatemen ...
10 0672327112_w1_wir.qxd 11/19/04 12:26 PM Page 218 ...
At a Glance You have finished the first week of learning how to program in C++. By now, you should feel comfortable entering pro ...
11 0672327112_w2_aag.qxd 11/19/04 12:26 PM Page 220 ...
DAY 8 WEEK 2 Understanding Pointers One of the powerful but low-level tools available to a C++ programmer is the capability to m ...
What Is a Pointer?................................................................................................ A pointer is ...
Understanding Pointers 223 8 LISTING8.1 Demonstrating the Address-of Operator 1: // Listing 8.1 Demonstrates address-of operator ...
assigns an address for it. For a longinteger that is typically four bytes, for example, an address to four bytes of memory is us ...
Understanding Pointers 225 8 For a pointer to hold an address, the address must be assigned to it. For the previous example, you ...
226 Day 8 The type tells the compiler how much memory is needed for the object at the address, which the pointer holds! In the d ...
Understanding Pointers 227 8 Pointers, Addresses, and Variables ................................................................ ...
This is two bytes (16 bits) whose decimal value is 5. The pointer variable is at location 106. Its value is 000 0000 0000 0000 0 ...
Understanding Pointers 229 26: cout << “Setting myAge = 9... “ << endl;^8 27: myAge = 9; 28: 29: cout << “myAg ...
LISTING8.3 Finding Out What Is Stored in Pointers 1: // Listing 8.3 2: // What is stored in a pointer. 3: #include <iostream& ...
Understanding Pointers 231 8 myAge: 5 yourAge: 10 &myAge: 0012FF7C &yourAge: 0012FF78 pAge: 0012FF78 *pAge: 10 &pAge ...
Why Would You Use Pointers?............................................................................ So far, you’ve seen step ...
Understanding Pointers 233 8 Local variables are on the stack, along with function parameters. Code is in code space, of course, ...
The disadvantage of the free store is also that the memory you reserve remains available until you explicitly state you are done ...
Understanding Pointers 235 8 Putting Memory Back: The deleteKeyword ................................................ When you ar ...
«
8
9
10
11
12
13
14
15
16
17
»
Free download pdf