Quote Originally Posted by kuda View Post
Thanks tabstop, that makes sense.

Here's my understanding so far:
Code:
Word *nw1 = *(Word * const *)w1;
  • nw1 is a pointer to what w1 points to. In other words, nw1, a pointer to Word, points to the same Word pointed to by w1.
  • Not quite: w1 is a pointer to a pointer to a Word. This is because your list itself contains pointers, and qsort passes the address of the element you are sorting, in this case the pointer to a Word - address of a pointer to Word -> pointer to pointer to Word.

    To get back to a pointer to word, you need to dereference (use one *).
  • For this to happen, w1 has to be cast into the right form and then dereferenced, so that nw1 points to w1's Word, not to the pointer w1 itself.