+ 2

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!

4th Dec 2017, 4:38 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
1 Respuesta
+ 3
@kurwius Thank you very much! //Silly me...
4th Dec 2017, 5:07 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar