Inserting a node before the pointer in linked list

########################################
Insert a new node to a link list when u dont know pointer to the starting node. Let u have a pointer P and u have to insert a node before that node.and P is not the starting node.

2 comments:

normaltusker said...

maga!!! your questions are real tuff da!! i don't remember anything out of C/C++ now!!!

Sathisha said...

let a->b->c-/_ be the list and given(not first) node is a.
create a new node 'x'.
copy contents of a to x.
put new value in a.
now, the structure is:
a->x->b->c-/_ .