Q:

Given a pointer of node to be deleted in a linked list . how will you pass a pointer to the node in main function?

Suppose I have a list [10 20 30 40 50 60]
I want to delete a node which has a data value 40, how would I pass the pointer of this node from main() function ?
I understand if I want to delete 10 the  I can simply pass head and if I want to delete 2nd node then i can pass head->next, but what if the list is so big and suppose I want to delete 70th node? 

A:

In general, whatever be the length, you have to take the approach,

Start traversing the linked list nodes, starting from the head, one by one.
Arrive at a particular node, check the data value.

if a match, update the pointer to next (previous) node(s).
if no match, move to next node.

continue until you reach the leaf node.

Regarding passing the node, you can simply pass the pointer to the node to be freed up and deallocate the memory from the deletion function. before calling the deletion function, you need to make the required changes to re-align the list, without the to-be-deleted node.
Write the code, if you face any issues, we'll be happy to help.

