Sunday, 6 May 2012

Updating a node value in Linked List in C


void modify(int oldvalue,int newvalue)
{
node *ptr=start;
while(ptr->info!=oldvalue&&ptr!=NULL)
{
ptr=ptr->link;
}
if(ptr->info==oldvalue)
{
ptr->info=newvalue;
}
else
{
printf("\n\n%d not found in the linked list\n",oldvalue);
getch();
}
}

No comments:

Post a Comment