figure 14.1 comparison of pointer and chapter 14 · title: hanly_224159_ppt14a.ppt author: angryk...

4
1 Chapter 14 Dynamic Data Structures Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-2 Figure 14.1 Comparison of Pointer and Nonpointer Variables Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-3 Figure 14.2 Function with Pointers as Output Parameters Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-4 Figure 14.3 Data Area of a Function with Three Pointer-Type Local Variables Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-5 Figure 14.4 Dynamic Allocation of Variables for an int, a char, and a Five-Component planet_t Structure Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-6 Figure 14.5 Assignment of Values to Dynamically Allocated Variables

Upload: others

Post on 06-Feb-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

  • 1

    Chapter 14Dynamic Data Structures

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-2

    Figure 14.1 Comparison of Pointer andNonpointer Variables

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-3

    Figure 14.2 Function with Pointers as Output Parameters

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-4

    Figure 14.3 Data Area of a Function with Three Pointer-Type Local Variables

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-5

    Figure 14.4 Dynamic Allocation of Variables for anint, a char, and a Five-Component planet_t Structure

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-6

    Figure 14.5 Assignment of Values to Dynamically Allocated Variables

  • 2

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-7

    Figure 14.6 Referencing Components of a Dynamically Allocated Structure

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-8

    Figure 14.7 Allocation of Arrays with calloc

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-9

    Figure 14.7 Allocation of Arrays with calloc(cont’d)

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-10

    Figure 14.8 Stack and Heap After Program Fragment in Fig. 14.7

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-11

    Figure 14.9 Multiple Pointers to a Cell in the Heap

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-12

    Figure 14.10 Children’s Pop Beads in a Chain

  • 3

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-13

    Figure 14.11 Multiple Pointers to the Same Structure

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-14

    Figure 14.12 Linking Two Nodes

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-15

    Figure 14.13 Three-Node Linked List with Undefined Final Pointer

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-16

    Figure 14.14 Three-Element Linked List Accessed Through n1_p

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-17

    Figure 14.15 Linked List After an Insertion

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-18

    Figure 14.16 Linked List After a Deletion

  • 4

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-19

    Figure 14.17 Function print_list

    Copyright ©2004 Pearson Addison-Wesley. All rights reserved. 14-20

    Figure 14.18 Comparison of Recursive and Iterative List Printing