hi guys. while running this program, i am getting program stopped working error. i want to remove a particular node in linked list by recursion. here is partial code for that which I believe contains the error. any help would be appreciated!
data* recursion(int nth_info,int zero)///to get to particular list///int zero to always be kept zero///here info= 1 single node of linked list
{
data* p_current;
if(zero==0)
{
p_current=p_list; ///p_list=beginning of list, global variable
}
++zero;
if(zero==nth_info)
{
return p_current;
}
else
{
recursion(nth_info,zero);
}
}
void remove_nth_info(int nth_info)
{
data* p_to_remove=recursion(nth_info,0);
/* if(p_to_remove->p_previous_info==p_list)
{
p_list=NULL;
}
else
{*/
p_to_remove->p_previous_info->p_next_info=p_to_remove->p_next_info;///if i comment it out, dont get error!
///}
}
int main()
{
///adding new items in list here
remove_nth_info(2);
}