Donate

0 Arrays of Pointer-Pointers

We can have arrays of pointers since pointers are variables.
Example use: Sort lines of text of different length.
Note: Text can't be moved or compared in a single operation.
Arrays of Pointers are a data representation that will cope efficiently and conveniently with variable length text lines.
How can we do this: Store lines end-to-end in one big char array n will delimit lines.
Store pointers in a different array where each pointer points to 1st char of each new line.
Compare two lines using strcmp () standard library function.
If 2 lines are out of order swap pointer in pointer array (not text).

If you enjoyed this post, make sure you subscribe to my RSS feed!


0 Responses to "Arrays of Pointer-Pointers"

Post a Comment