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.
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.
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.
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.