i want to add all the inserted linked list by using this code
but what happens here if i input 15 then 35 =50 but when i input again 30 the sum is 50whats wrong with my code?
int sum(nd **head){
nd *p,*sum1;
p=*head;
sum1=0;
while(p!=NULL)
{
sum1->x=p->x;
p=p->next;
return sum1->x=sum1->x+p->x;
}
}