Thought I'd also have a go at translating ch-1.pl and ch-2.pl into C.. Both C versions produce very similar (non-debugging and debugging) output to the Perl originals. However, ch-2.c is a complete rethink, as usual I solved ch-2.pl in a Perlish idiomatic way using (for example) a hashset for distinct values and an array of arrays for the output. Storage management in C is much harder, so I decided to store the output sequences in the (reordered) list[nel] array, i.e. an inplace solution because we already had the right amount of storage allocated, storing size elements per sequence. This led me to construct the desired output on the fly at the end. In addition, to make things simpler to reason about I decided to start by sorting the entire list[nel] array via qsort - so from then I passed the "sorted list[ nel]" array around instead. To check whether an element was present in a sorted subarray, I used a simple "posisin( v, arr, s, f )" function to check whether v is in arr[s..f], returning the position >= 0 if found, or -1 if not found. This implemented distinct-ness and set membership. These C versions use some of my regular support modules: - my command-line argument processing module args.[ch], - my csvlist-of-int parsing module parseints.[ch], and - my int-array printing module printarray.[ch].