Garbage value returned by list.front()? [ANSWERED] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
Kinshuk Vasisht
Kinshuk Vasisht - avatar
1 Answer
+ 3
@kurwius Thank you very much! //Silly me...
4th Dec 2017, 5:07 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar