I am trying to only count even number of nodes in a linked list and then delete them. However it doesn't count all the even number and deletes everything. Where am I messing up?
removeEven makes no effort to keep the structure of the list in tact. You happily delete nodes without updating the nodes pointing to them. You also don't bother to update the head if it should require deletion.