4 ms·
Of course! I hadn't considered that inserting an element can mean updating an already existing element. In C you don't need a pointer to the last element thoug
by kmm 15y ago
Of course! I hadn't considered that inserting an element can mean updating an already existing element.
In C you don't need a pointer to the last element though, you can just replace the pointer to the first element with the new element and put the old pointer in the "next" field of the new element. I usually implement stacks this way.