+ 1
Why output is double free or corruption out aborted?
here initially 4 nodes and n=node to be deleted =2;prec=precedure node https://code.sololearn.com/c2AEiLsABayN/?ref=app
4 Antworten
+ 1
I had the same problem and problem causes because you copy temp pointer to prec and when you delete temp you are deleting prec too.
+ 1
how should I overcome this problem then??
+ 1
Yes.
In this code you aren't allocing new memory so you are deleting the last memory you were alloced to overcome this problem you should alloc new memory and copy content of last allocing and delete that.
+ 1
I have corrected it it is delete (*temp)