• AnanaceA
    link
    fedilink
    arrow-up
    15
    ·
    11 months ago

    If you build a linked list in C, and put the pointer to the next entry as the first element in your struct, then you only need a single variable (and two comparisons) to do sorted insertion into the list.

    • Blue_Morpho@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      11 months ago

      That’s too complicated for me to understand so here is my thing I know:

      When using example code from the Internet, it’s important to read the comments at the top of the file before going to far into adapting it and then wondering why it isn’t working.