figures for chapter 14 pointers

28
©2004 Brooks/Cole FIGURES FOR CHAPTER 14 POINTERS Click the mouse to move to the next page. Use the ESC key to exit this chapter. This chapter in the book includes: Introduction 14.1 The Concept of Pointers 14.2 Breadth: Memory 14.3 Arrays and Pointers 14.4 Dynamic Memory Allocation 14.5 Pointer Data Members 14.6 User-Defined Types 14.7 Pointers and Structures 14.8 Function Pointers Programming and Debugging Hints Key Terms Summary Review Questions Laboratory

Upload: bryony

Post on 03-Feb-2016

68 views

Category:

Documents


0 download

DESCRIPTION

This chapter in the book includes: Introduction 14.1The Concept of Pointers 14.2Breadth: Memory 14.3Arrays and Pointers 14.4Dynamic Memory Allocation 14.5Pointer Data Members 14.6User-Defined Types 14.7Pointers and Structures 14.8Function Pointers - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

FIGURES FOR

CHAPTER 14POINTERS

Click the mouse to move to the next page.Use the ESC key to exit this chapter.

This chapter in the book includes:Introduction

14.1 The Concept of Pointers14.2 Breadth: Memory14.3 Arrays and Pointers14.4 Dynamic Memory Allocation14.5 Pointer Data Members14.6 User-Defined Types14.7 Pointers and Structures14.8 Function Pointers

Programming and Debugging HintsKey TermsSummaryReview QuestionsLaboratory

Page 2: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.1: Memory after declaration and assignment statements involving a pointer

Page 3: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.2: Representation of memory after ptr = &v;

Page 4: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.3: Memory after execution ofeither statement

Page 5: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.4: Memory after execution of ptr = NULL

Page 6: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Table 14.1: Summary of Meaning of Code for Declaration-Initializations int v = 5, *ptr = &v;

Page 7: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.5: Memory after execution of declaration-initialization

Page 8: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.6: Effect on memory of p = q;

Page 9: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.7: Effect on memory of q = &k;

Page 10: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.8: Memory after execution of p = q;

Page 11: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.9: Memory after execution of the following statements

Page 12: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.10: Memory after execution of *p = 7;

Page 13: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 4.11:

Flow of information in a system with a

cache

Page 14: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.12: Storage of an integer array in a byte-addressable computer with each

integer in 2 bytes

Page 15: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.13: Memory after declaration-initialization in Example 14.4

Page 16: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.14: Storage of an integer array in a byte-addressable computer, with each integer

in 2 bytes and access through pointers

Page 17: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.15: Structure chart for program of Example 14.5

Page 18: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.16: Action ofGreetings hi(“main”);

Page 19: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.17: Action of the default copy constructor

Page 20: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.18: Action of hi.asterisk() indirectly affects cpy

Page 21: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.19: Action of user-defined copy constructor

Page 22: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.20: Action of default assignment operator

Page 23: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.21: Linked list of nodes with grocery information

Page 24: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.22: Linked list after declaration of head and allocation of a first node

Page 25: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.23: Linked list after filling the first node

Page 26: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.24: Memory after allocation of the second node in the linked list

Page 27: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.25: Action of *p++ or *(p++)

Page 28: FIGURES FOR CHAPTER 14 POINTERS

©2004 Brooks/Cole

Figure 14.26: Action of (*p)++