Garbage value returned by list.front()? [ANSWERED]
I have created the following code for a challenge : https://code.sololearn.com/cgZCDTfhoSJ0/?ref=app In the end, when the list size becomes one, the program is supposed to return the sum of the list elements, but my program is returning a garbage value! Neither my list is empty at that time (A cout operation of the list returns correct value) , nor I am using a pointer of any sort that got deallocated. Please help me correct the error!