PinChangeInt library- To attach interrupts to multiple Arduino (Uno/Mega) pins

                } while (tmp != NULL);

This won't work because tmp will become null, which will exit us from the loop.

I need tmp->next later in the code, therefore I need the last non-null value of tmp.