Wednesday, May 25, 2011

5.6 Pointer Arrays; Pointers to Pointers

  • Pointers are variables and can be stored in arrays
  • Sort a set of text lines in alphabet order:









  • Each line of character array can be accessed by a pointer to its first character and pointers themselves can be stored in an array
  • When two out-of-order lines have to be exchanged, the pointers in the pointer array are exchanged, not the text lines themselves
  • These prevent complicated storage management and high overhead of moving the lines themselves

No comments:

Post a Comment